Exemple #1
0
 public void AcceptRequest()
 {
     if (BuddyRequests.Count != 0)
     {
         BuddyData requestor = BuddyRequests.Dequeue();
         Add(requestor);
         if (requestor.GetBuddyList() != null)
         {
             requestor.GetBuddyList().SendUpdate(Owner, false);
         }
         PollRequests();
     }
 }
Exemple #2
0
        public void Request(BuddyData requestor)
        {
            if (requestor.GetBuddyList().IsFull())
            {
                log.Warn($"[{Owner.charName}] Buddylist invite failed: its full");
                requestor.GetBuddyList().SendRequestError(11);
                return;
            }

            if (Owner.GetChar().IsGM&& requestor.GetChar().IsGM == false)
            {
                log.Warn($"[{Owner.charName}] Buddylist invite failed: nonadmin to admin invite");
                requestor.GetBuddyList().SendRequestError(14);
                return;
            }

            if (HasBuddy(requestor))
            {
                log.Warn($"[{Owner.charName}] Buddylist invite failed: already as buddy");
                requestor.GetBuddyList().Add(Owner);
                SendBuddyList(); //TODO test sending Update. Sometimes we send full buddylist when it seems like only an update is necessary
                return;
            }
            if (IsFull())
            {
                log.Warn($"[{Owner.charName}] Buddylist invite failed: own is full");
                requestor.GetBuddyList().SendRequestError(12);
                return;
            }

            log.Warn($"[{Owner.charName}] invited {requestor.charName}");

            requestor.GetBuddyList().Add(Owner);
            BuddyRequests.Enqueue(requestor);
            if (BuddyRequests.Count == 1)
            {
                PollRequests();
            }
        }
Exemple #3
0
 public Boolean IsVisibleTo(BuddyData other)
 {
     return(other.IsOnline() && other.GetBuddyList().HasBuddy(this));
 }