private RongCloud(string appKey, string appSecret) { User = new User(appKey, appSecret); Message = new Message(appKey, appSecret); WordFilter = new Wordfilter(appKey, appSecret); Group = new Group(appKey, appSecret); Chatroom = new Chatroom(appKey, appSecret); Push = new Push(appKey, appSecret); SMS = new SMS(appKey, appSecret); }
private RongCloud(String appKey, String appSecret) { user = new User(appKey, appSecret); message = new Message(appKey, appSecret); wordfilter = new Wordfilter(appKey, appSecret); group = new Group(appKey, appSecret); chatroom = new Chatroom(appKey, appSecret); push = new Push(appKey, appSecret); sms = new SMS(appKey, appSecret); }
private static void UserChat(Session Session, ClientMessage Message) { if (Session.CharacterInfo.IsMuted) { return; } RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId); if (Instance == null) { return; } RoomActor Actor = Instance.GetActorByReferenceId(Session.CharacterId); if (Actor == null) { return; } bool Shout = (Message.Id == OpcodesIn.ROOM_CHAT_SHOUT); string MessageText = UserInputFilter.FilterString(Message.PopString()); if (MessageText.Length == 0) { return; } if (MessageText.Length > 100) { MessageText = MessageText.Substring(0, 100); } MessageText = Wordfilter.Filter(MessageText); if (MessageText.StartsWith(":") && (ChatCommands.HandleCommand(Session, MessageText) || Session.HasRight("moderation_tool"))) { return; } if (Instance.WiredManager.HandleChat(MessageText, Actor)) { Actor.Whisper(MessageText, 0); return; } Actor.Chat(MessageText, Shout, Session.HasRight("mute")); if (Instance.HumanActorCount > 1) { QuestManager.ProgressUserQuest(Session, QuestType.SOCIAL_CHAT); } }
private RongCloud(String appKey, String appSecret) { user = new User(appKey, appSecret); user.RongCloud = this; message = new Message(appKey, appSecret); message.RongCloud = this; conversation = new Conversation(appKey, appSecret); conversation.RongCloud = this; group = new Group(appKey, appSecret); group.RongCloud = this; wordfilter = new Wordfilter(appKey, appSecret); wordfilter.RongCloud = this; sensitiveword = new SensitiveWord(appKey, appSecret); sensitiveword.RongCloud = this; chatroom = new Chatroom(appKey, appSecret); chatroom.RongCloud = this; }
private RongCloud(String appKey, String appSecret) { User = new User(appKey, appSecret); User.RongCloud = this; Message = new Message(appKey, appSecret); Message.RongCloud = this; Conversation = new Conversation(appKey, appSecret); Conversation.RongCloud = this; Group = new Group(appKey, appSecret); Group.RongCloud = this; Wordfilter = new Wordfilter(appKey, appSecret); Wordfilter.RongCloud = this; Sensitiveword = new SensitiveWord(appKey, appSecret); Sensitiveword.RongCloud = this; Chatroom = new Chatroom(appKey, appSecret); Chatroom.RongCloud = this; Push = new Push(appKey, appSecret); Push.RongCloud = this; Broadcast = new Broadcast(appKey, appSecret); Broadcast.RongCloud = this; }
public static void Main(string[] args) { mAlive = true; DateTime InitStart = DateTime.Now; // Set up basic output Console.WriteLine("Initializing Snowlight..."); // Cannot be localized before config+lang is loaded // Load configuration, translation, and re-configure output from config data ConfigManager.Initialize(Constants.DataFileDirectory + "server-main.cfg"); Output.InitializeStream(true, (OutputLevel)ConfigManager.GetValue("output.verbositylevel")); Output.WriteLine("Initializing Snowlight..."); Localization.Initialize(Constants.LangFileDirectory + "lang_" + ConfigManager.GetValue("lang") + ".lang"); // Process args foreach (string arg in args) { Output.WriteLine(Localization.GetValue("core.init.cmdarg", arg)); Input.ProcessInput(arg.Split(' ')); } try { // Initialize and test database Output.WriteLine(Localization.GetValue("core.init.mysql")); SqlDatabaseManager.Initialize(); // Initialize network components Output.WriteLine(Localization.GetValue("core.init.net", ConfigManager.GetValue("net.bind.port").ToString())); mServer = new SnowTcpListener(new IPEndPoint((IPAddress)ConfigManager.GetValue("net.bind.ip"), (int)ConfigManager.GetValue("net.bind.port")), (int)ConfigManager.GetValue("net.backlog"), new OnNewConnectionCallback( SessionManager.HandleIncomingConnection)); Output.WriteLine(Localization.GetValue("core.init.net", ConfigManager.GetValue("net.cmd.bind.port").ToString())); musServer = new SnowTcpListener(new IPEndPoint((IPAddress)ConfigManager.GetValue("net.cmd.bind.ip"), (int)ConfigManager.GetValue("net.cmd.bind.port")), (int)ConfigManager.GetValue("net.backlog"), new OnNewConnectionCallback( CommandListener.parse)); using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient()) { Output.WriteLine(Localization.GetValue("core.init.dbcleanup")); PerformDatabaseCleanup(MySqlClient); Output.WriteLine(Localization.GetValue("core.init.game")); // Core DataRouter.Initialize(); // Sessions, characters Handshake.Initialize(); GlobalHandler.Initialize(); SessionManager.Initialize(); CharacterInfoLoader.Initialize(); RightsManager.Initialize(MySqlClient); SingleSignOnAuthenticator.Initialize(); // Room management and navigator RoomManager.Initialize(MySqlClient); RoomInfoLoader.Initialize(); RoomHandler.Initialize(); RoomItemHandler.Initialize(); Navigator.Initialize(MySqlClient); // Help and moderation HelpTool.Initialize(MySqlClient); ModerationPresets.Initialize(MySqlClient); ModerationTicketManager.Initialize(MySqlClient); ModerationHandler.Initialize(); ModerationBanManager.Initialize(MySqlClient); // Catalog, pets and items ItemDefinitionManager.Initialize(MySqlClient); CatalogManager.Initialize(MySqlClient); CatalogPurchaseHandler.Initialize(); Inventory.Initialize(); ItemEventDispatcher.Initialize(); PetDataManager.Initialize(MySqlClient); // Messenger MessengerHandler.Initialize(); // Achievements and quests AchievementManager.Initialize(MySqlClient); QuestManager.Initialize(MySqlClient); // Misc/extras CrossdomainPolicy.Initialize("Data\\crossdomain.xml"); InfobusManager.Initialize(); ActivityPointsWorker.Initialize(); BotManager.Initialize(MySqlClient); InterstitialManager.Initialize(MySqlClient); ChatEmotions.Initialize(); EffectsCacheWorker.Initialize(); RecyclerManager.Initialize(MySqlClient); DrinkSetManager.Initialize(MySqlClient); SongManager.Initialize(); TradeHandler.Initialize(); RandomGenerator.Initialize(); StatisticsSyncUtil.Initialize(); Wordfilter.Initialize(MySqlClient); // Polish WarningSurpressors.Initialize(); } } catch (Exception e) { HandleFatalError(Localization.GetValue("core.init.error.details", new string[] { e.Message, e.StackTrace })); return; } // Init complete TimeSpan TimeSpent = DateTime.Now - InitStart; Output.WriteLine(Localization.GetValue("core.init.ok", Math.Round(TimeSpent.TotalSeconds, 2).ToString()), OutputLevel.Notification); Output.WriteLine((string)Localization.GetValue("core.init.ok.cmdinfo"), OutputLevel.Notification); Console.Write("$" + Environment.UserName.ToLower() + "@snowlight> "); Console.Beep(); Input.Listen(); // This will make the main thread process console while Program.Alive. }
private static void OnInvite(Session Session, ClientMessage Message) { int Count = Message.PopWiredInt32(); List <uint> Targets = new List <uint>(); for (int i = 0; (i < Count && i < 50); i++) { Targets.Add(Message.PopWiredUInt32()); } string MessageText = UserInputFilter.FilterString(Message.PopString()); if (MessageText.Length > 121) { MessageText = MessageText.Substring(0, 121); } List <Session> Users = new List <Session>(); foreach (uint UserId in Targets) { if (!Session.MessengerFriendCache.Friends.Contains(UserId)) { continue; } Session TargetSession = SessionManager.GetSessionByCharacterId(UserId); if (TargetSession == null) { continue; } Users.Add(TargetSession); TargetSession.SendData(MessengerImInviteComposer.Compose(Session.CharacterId, Wordfilter.Filter(MessageText))); } using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient()) { String to = ""; foreach (Session User in Users) { to += User.CharacterInfo.Username + " [" + User.CharacterId + "], "; } to = to.Substring(0, to.Length - 2); ModerationLogs.LogChatMessage(MySqlClient, Session.CharacterId, 0, "(INVITATION to " + to + ") " + MessageText); } }
private static void OnSendIm(Session Session, ClientMessage Message) { uint UserId = Message.PopWiredUInt32(); string Text = UserInputFilter.FilterString(Message.PopString()).Trim(); if (UserId <= 0 || Text.Length < 1) { return; } if (Session.CharacterInfo.IsMuted) { Session.SendData(MessengerImErrorComposer.Compose(4, UserId)); return; } if (!Session.MessengerFriendCache.Friends.Contains(UserId)) { Session.SendData(MessengerImErrorComposer.Compose(6, UserId)); return; } Session TargetSession = SessionManager.GetSessionByCharacterId(UserId); if (TargetSession == null) { Session.SendData(MessengerImErrorComposer.Compose(5, UserId)); return; } if (TargetSession.CharacterInfo.IsMuted) { Session.SendData(MessengerImErrorComposer.Compose(3, UserId)); } TargetSession.SendData(MessengerImMessageComposer.Compose(Session.CharacterId, Wordfilter.Filter(Text))); using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient()) { ModerationLogs.LogChatMessage(MySqlClient, Session.CharacterId, 0, "(MESSAGE to " + TargetSession.CharacterInfo.Username + " [" + TargetSession.CharacterId + "]) " + Text); } }
private string get_post_string(GenericPost gp) { JsonObject jObject = new JsonObject(); if (gp.IsOpPost) { AniWrap.DataTypes.Thread t = (AniWrap.DataTypes.Thread)gp; jObject.Put("Closed", t.IsClosed); jObject.Put("Sticky", t.IsSticky); } jObject.Put("Board", gp.Board); jObject.Put("ID", gp.ID); jObject.Put("Name", gp.Name); if (gp.Capcode != GenericPost.CapcodeEnum.None) { jObject.Put("Capcode", gp.Capcode.ToString()); } if (!string.IsNullOrEmpty(gp.Comment)) { jObject.Put("RawComment", Wordfilter.Process(gp.Comment)); // dic.Add("FormattedComment", gp.CommentText); } /*// Flag stuffs*/ if (!string.IsNullOrEmpty(gp.country_flag)) { jObject.Put("CountryFlag", gp.country_flag); } if (!string.IsNullOrEmpty(gp.country_name)) { jObject.Put("CountryName", gp.country_name); } /* Flag stuffs //*/ if (!string.IsNullOrEmpty(gp.Email)) { jObject.Put("Email", gp.Email); } if (!string.IsNullOrEmpty(gp.Trip)) { jObject.Put("Trip", gp.Trip); } if (!string.IsNullOrEmpty(gp.Subject)) { jObject.Put("Subject", gp.Subject); } if (!string.IsNullOrEmpty(gp.PosterID)) { jObject.Put("PosterID", gp.PosterID); } jObject.Put("Time", gp.Time.ToString()); if (gp.File != null) { jObject.Put("FileHash", Program.base64tostring(gp.File.hash)); jObject.Put("FileName", Wordfilter.Process(gp.File.filename) + "." + gp.File.ext); jObject.Put("ThumbTime", gp.File.thumbnail_tim); jObject.Put("FileHeight", gp.File.height); jObject.Put("FileWidth", gp.File.width); jObject.Put("FileSize", gp.File.size); } return(jObject.ToString()); }