/// <summary> /// Will request banning someone (only works with given permissions) /// </summary> /// <param name="target"></param> public void Ban(Common.ChatClientWrapper target, string reason="banned from server") { Common.ChatClientMessageWrapper send = new Common.ChatClientMessageWrapper(target, reason); byte[] queue = Common.ObjectSerializer.Serialize(send); SendPacket(8, queue); }
/// <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> /// Will send a private message to the given target /// </summary> /// <param name="target"></param> /// <param name="msg"></param> public void PrivateMessage(Common.ChatClientWrapper target, string msg) { Common.ChatClientMessageWrapper send = new Common.ChatClientMessageWrapper(target, msg); byte[] queue = Common.ObjectSerializer.Serialize(send); SendPacket(10, queue); }
/// <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); } }