Пример #1
0
        private void ChangePresence(String user, Presence presence)
        {
            Logger.Debug("Change Presence Request for " + user);
            if (!ServicePartyAttendanceLookup.ContainsKey(user))
            {
                if (PresenceType.unavailable.Equals(presence.Type))
                {
                    return;
                }
                // if we are getting presence alerts (excl unavail), we need to create this user
                AddUsernameToList(user, presence);
            }
            Attendance servicePersonAttendance = _appContext.RosterManager.GetServicePersonAttendance(user);

            if (servicePersonAttendance != null)
            {
                servicePersonAttendance.SetPresence(presence);
                Logger.Debug("Incoming presence change for " + user + " [" + presence + "], resource = " + presence.Resource + ", shortCode = " + presence.ShortCode + ", priority " + presence.Priority);
                Logger.Info("Presence change, now " + user +
                            (servicePersonAttendance.Presence.IsOnline ?
                             " is available " + "[" + servicePersonAttendance.Presence + "], resource " + servicePersonAttendance.Presence.Resource + ", shortCode = " + servicePersonAttendance.Presence.ShortCode + ", priority " + servicePersonAttendance.Presence.Priority :
                             " is no longer available " + "[" + servicePersonAttendance.Presence + "]")
                            );
            }
        }
Пример #2
0
 internal Attendance GetServicePersonAttendance(String username)
 {
     if (ServicePartyAttendanceLookup.ContainsKey(username))
     {
         return(ServicePartyAttendanceLookup[username]);
     }
     return(null);
 }
Пример #3
0
 public void SubscribePerson(Person person)
 {
     // Lets add this person to the roster
     Logger.Debug("Attempting to add " + person + " to " + _appContext.CurrentUserManager.CurrentUser.Username + "'s Team");
     if (ServicePartyAttendanceLookup.ContainsKey(person.Username))
     {
         Logger.Error("Will not add " + person.Username + " to list, he/she already exists");
     }
     else
     {
         _appContext.ConnectionManager.Connection.RequestAsync <SubscribeRq, SubscribeRs>(new SubscribeRq()
         {
             username = person.Username, subscribe = true
         },
                                                                                          (request, response, ex) =>
                                                                                          SubscribePersonResponseHandler(request, response, ex, person));
     }
 }