/// <summary> /// Will ban a given user with optional reason /// </summary> /// <param name="cc"></param> /// <param name="reason"></param> public void Ban(ChatClient cc, string reason="banned from server") { bans.Add(cc.GetBase()); Kick(cc, reason); }
/// <summary> /// Client requests Private Message to another client /// </summary> /// <param name="me"></param> /// <param name="target"></param> void c_PrivateMessageEvent(ChatClient me, Common.ChatClientMessageWrapper target) { string targetUID = target.UniqueID; ChatClient targ = null; foreach (ChatClient cc in clients) if (cc.UniqueID == targetUID) targ = cc; if (targ == null) me.SendError("invalid client"); else { Common.ChatClientMessageWrapper ccmw = new Common.ChatClientMessageWrapper(me.GetBase(), target.Message); targ.PrivateMessage(ccmw); PrivateMessageEvent.Invoke(me, targ); } }
/// <summary> /// A client sent a public chatmessage /// </summary> /// <param name="me"></param> /// <param name="s"></param> void c_GlobalMessageEvent(ChatClient me, string s) { GlobalMessageEvent.Invoke(me, s); Common.ChatClientMessageWrapper ccmw = new Common.ChatClientMessageWrapper(me.GetBase(), s); foreach (ChatClient cc in clients) { cc.PublicMessage(ccmw); } }
/// <summary> /// Client Disconnected for whatever reason /// </summary> /// <param name="me"></param> /// <param name="s"></param> void c_DisconnectedEvent(ChatClient me, string s) { DisconnectedEvent.Invoke(me, s); foreach (ChatClient cc in clients) { cc.ClientLeft(me.GetBase()); } }
/// <summary> /// Client Successfully authenticated as client /// </summary> /// <param name="me"></param> void c_AuthenticatedEvent(ChatClient me) { AuthenticatedEvent.Invoke(me); foreach (ChatClient cc in clients) { cc.ClientJoined(me.GetBase()); } }
/// <summary> /// Used to call an client-update if permissions were changed /// </summary> /// <param name="cc"></param> public void ClientUpdate(ChatClient me) { foreach (ChatClient cc in clients) { cc.ClientUpdate(me.GetBase()); } }