Inheritance: API.Response
Esempio n. 1
0
 public Response process(Request req)
 {
     SubscribeRq request = (SubscribeRq)req;
     SubscribeRs response = new SubscribeRs();
     if (request.subscribe)
     {
         TrueFalseNotification notification;
         if (request.team)
         {
             notification = new JoinTeamNotification()
             {
                 Manager = _appContext.NotificationManager,
                 Avatar =
                     request.teamElement.hasAvatar
                         ? Convert.FromBase64String(request.teamElement.avatarData)
                         : null,
                 Name = request.teamElement.name,
                 Location = request.teamElement.location,
                 Message = "Join Team?",
                 TeamUsername = request.teamElement.user,
             };
         }
         else
         {
             notification = new AddBuddyNotification()
             {
                 Manager = _appContext.NotificationManager,
                 Avatar =
                     request.userElement.hasAvatar
                         ? Convert.FromBase64String(request.userElement.avatarData)
                         : null,
                 Name = request.userElement.name,
                 Location = request.userElement.location,
                 Message = "Add Contact?",
             };
         }
         notification.AnswerHandler.Answered += delegate { ProcessAnswer(notification.AnswerHandler.Answer, request.username); };
         _appContext.NotificationManager.AddNotification(notification);
         _appContext.UIManager.Show();
     }
     return response;
 }
Esempio n. 2
0
 private void SubscribePersonResponseHandler(SubscribeRq request, SubscribeRs response, Exception e, Person person)
 {
     if (e == null)
     {
         person.SubscriptionStatus = "subscribe";
         Logger.Debug("Succeeded in sending subscribe request for " + person.Username);
     }
     else
     {
         Logger.Error("Failed to subscribe to " + person.Username + " : " + e.Message, e);
     }
 }
Esempio n. 3
0
 private void SubscribeRequestResponseHandler(SubscribeRq request, SubscribeRs response, Exception e)
 {
     if (e != null)
     {
         Logger.Error("Failed to send subscribe answer to " + request.username + " : " +
                      e.Message, e);
     }
 }