Пример #1
0
 /// <summary>
 /// A client requested unban of another client
 /// </summary>
 /// <param name="me"></param>
 /// <param name="target"></param>
 void c_UnbanRequest(ChatClient me, Common.ChatClientWrapper target)
 {
     if (me.PermLevel < 2)
     {
         me.SendError("no permissions");
         return;
     }
     string targetUID = target.UniqueID;
     Common.ChatClientWrapper targ = null;
     foreach (Common.ChatClientWrapper cc in bans)
         if (cc.UniqueID == targetUID)
             targ = cc;
     if (targ == null)
         me.SendError("invalid client");
     else
     {
         bans.Remove(targ);
         UnbanEvent.Invoke(me, targ);
     }
 }
Пример #2
0
        /// <summary>
        /// A client-side Kick request
        /// </summary>
        /// <param name="me"></param>
        /// <param name="target"></param>
        void c_KickRequest(ChatClient me, Common.ChatClientMessageWrapper target)
        {
            if(me.PermLevel < 1) {
                me.SendError("no permissions");
                return;
            }

            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
                Kick(targ, target.Message);
        }
Пример #3
0
 /// <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);
     }
 }
Пример #4
0
 /// <summary>
 /// Client requests ban-list
 /// </summary>
 /// <param name="me"></param>
 void c_BanListRequest(ChatClient me)
 {
     if (me.PermLevel < 2) {
         me.SendError("no permissions");
         return;
     }
     Common.ChatClientListWrapper send = new Common.ChatClientListWrapper();
     send.List.AddRange(bans);
     me.SendbanList(send);
 }