private void HandleInviteResponse(LoggedClient loggedClient, BaseMessage baseMessage) { try { InviteResponse inviteResponse = null; try { inviteResponse = InviteResponse.Deserialize(baseMessage); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } if (inviteResponse != null) { var inviteGroup = GetClientInviteGroup(loggedClient); if (inviteGroup != null) { inviteGroup.AddInviteResponse(loggedClient.Username, inviteResponse); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }
public void _InviteResponse(bool accept, int dstuserid) { InviteResponse inviteResponse = new InviteResponse(); inviteResponse.Accept = accept; inviteResponse.Srcuserid = dstuserid; Message message = new Message(); message.Type = BombplaneProto.Type.InviteResponse; message.Inviteresponse = inviteResponse; NetworkClient.Generate_Package(message); //Console.WriteLine("hello"); }
public void _InviteResponseNotification(Message message) { InviteResponse inviteResponse = message.Inviteresponse; if (inviteResponse.Accept) { ClientInfo.rival_user.invite = User.invite_state.accept; ClientInfo.send_invite_response_user.Enqueue(ClientInfo.rival_user); } else { ClientInfo.rival_user.invite = User.invite_state.decline; ClientInfo.send_invite_response_user.Enqueue(ClientInfo.rival_user); } }
public IActionResult DeleteInvite(User user) { user = userDAL.GetUser(user.Email); userDAL.DeleteInvite(user); InviteResponse ir = new InviteResponse() { Invitee = user, Inviter = user.Invite.InvitedBy, Family = familyDAL.GetFamily(user.Invite.FamilyId) }; emailProvider.DeclineInvite(ir); return(RedirectToAction("Index")); }
public void AddInviteResponse(string username, InviteResponse inviteResponse) { if (inviteResponse.IsAccepted == true) { if (inviteRosponses.ContainsKey(username)) { inviteRosponses[username] = inviteResponse; } else { inviteRosponses.Add(username, inviteResponse); } if (inviteRosponses.Count == LoggedClients.Count) { var groupCreatedEvent = GroupCreated; if (groupCreatedEvent != null) { groupCreatedEvent(this, new GroupCreatedEventArgs(LoggedClients, inviteRosponses)); } } } }
public bool DeclineInvite(InviteResponse ir) { bool output = false; try { to = new MailboxAddress(ir.Inviter.DisplayName, ir.Inviter.Email); message.To.Add(to); message.Subject = $"{ir.Invitee.DisplayName} has chosen not to join the {ir.Family.Name} family."; body.HtmlBody = $"<h1>Hi {ir.Inviter.DisplayName}!</h1><p>We just wanted to let you know that {ir.Invitee.DisplayName} has declined your request to join the {ir.Family.Name} family.</p><br><p>- The Let's Eat Team</p>"; message.Body = body.ToMessageBody(); output = Connect() && Send() ? true : false; } catch { output = false; } return(output); }
public IActionResult ChangeFamily(User user) { user = userDAL.GetUser(user.Email); if (String.IsNullOrEmpty(user.FamilyRole)) { user.FamilyRole = "Member"; } user.FamilyId = user.Invite.FamilyId; userDAL.ChangeFamily(user); InviteResponse ir = new InviteResponse() { Invitee = user, Inviter = user.Invite.InvitedBy, Family = familyDAL.GetFamily(user.FamilyId) }; emailProvider.AcceptInvite(ir); return(RedirectToAction("Index")); }
public IActionResult DeleteInvite(User user) { user = userDAL.GetUser(user.Email); ObjectResult output = StatusCode(500, error.DeleteInvite); if (user != null) { if (userDAL.DeleteInvite(user)) { output = StatusCode(200, authProvider.GetCurrentUser()); InviteResponse ir = new InviteResponse() { Invitee = user, Inviter = user.Invite.InvitedBy, Family = familyDAL.GetFamily(user.Invite.FamilyId) }; emailProvider.DeclineInvite(ir); } } return(output); }
public IActionResult ChangeFamily(User user) { ObjectResult output = StatusCode(500, error.ChangeFamily); user = userDAL.GetUser(user.Email); if (String.IsNullOrEmpty(user.FamilyRole)) { user.FamilyRole = "Member"; } if (user.Invite.FamilyId <= 1) { output = StatusCode(500, error.NoFamilyInvite); } else { user.FamilyId = user.Invite.FamilyId; if (userDAL.ChangeFamily(user)) { output = StatusCode(200, authProvider.GetCurrentUser()); InviteResponse ir = new InviteResponse() { Invitee = user, Inviter = user.Invite.InvitedBy, Family = familyDAL.GetFamily(user.FamilyId) }; emailProvider.AcceptInvite(ir); } } return(output); }
/// <summary> /// Event called when remote session responds to the invite. /// </summary> /// Handle cases where the event is accepted or rejected by the Remote /// session. The invite can also be timed out or ignored. /// <param name="session"> remote session</param> /// <param name="response">invitation responce by the remote session</param> private void SC_InviteResponded(STCSession session, InviteResponse response) { }