Пример #1
0
 /// <summary>
 /// Update the information about a given user.
 /// Runs on a different thread and therefor returns instantly
 /// </summary>
 /// <param name="u">User to update</param>
 public void UpdateUser(User u) => ServerFrameWork.QUWI("UpdateUser", (o) => {
     var us = o as User;
     WaitforDeadLock();
     users.Update(us);
     TurboMap.Update();
     Scoreboard.Update();
     C.WriteLine($"Updated: {us.Username}");
 }, u);
 /// <summary>
 /// Manually causes the buffers to update
 /// </summary>
 public void Update()
 {
     lock (this) {
         if (IsBusy)
         {
             return;
         }
         IsBusy = true;
     }
     ServerFrameWork.QUWI("SwMa<" + typeof(T).Name + ">::Update", Thread);
 }
Пример #3
0
 /// <summary>
 /// Sends a restore Email to a user.
 /// Runs <see langword="async"/> on a different thread, so this method exits instantly
 /// </summary>
 /// <param name="email">Email of the user to send the restore to</param>
 /// <param name="parent">Calling <see cref="IServer"/>(used for acquiring the URL)</param>
 public void RestoreAccount(string email, IServer parent) => ServerFrameWork.QUWI("DB::RestoreAccount", () => {
     WaitforDeadLock();
     var u = FindEmail(email);
     if (u == null)
     {
         return;
     }
     var fakeSess = new SessionID(-u.Id, rng)
     {
         DeathOn = DateTime.Now + new TimeSpan(1, 0, 0, 0)
     };
     try {
         Email.SendRestoreKey($"{ServerInfo.CreateURL.ToTStorage()(parent)}EmailValidation?id={u.Id}&valid={fakeSess.SID}", email);
         sids.Insert(fakeSess);
     }
     catch { }
 });
Пример #4
0
 /// <summary>
 /// Send the deletion request email.
 /// </summary>
 /// <param name="email">Email of the user to send the verification E-mail to</param>
 /// <param name="parent">Calling <see cref="IServer"/>(used for acquiring the URL)</param>
 public void SndDelteEmail(string email, IServer parent) => ServerFrameWork.QUWI("DB::SndDelteEmail", () => {
     WaitforDeadLock();
     var u = FindEmail(email);
     if (u == null)
     {
         return;
     }
     var fakeSess = new SessionID(-u.Id, rng)
     {
         DeathOn = DateTime.Now + new TimeSpan(1, 0, 0)
     };
     try {
         string gen(string a) => $"{ServerInfo.CreateURL.ToTStorage()(parent)}EmailValidation/Delete?action={a}&id={u.Id}&valid={fakeSess.SID}";
         Email.SendDeleteEmail(gen(a_delete), gen(a_cancel), email);
         sids.Insert(fakeSess);
     }
     catch { }
 });