Inheritance: IPresence
Example #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 + "]")
                         );
     }
 }
Example #2
0
 private void AddUsernameToList(String username, Presence presence)
 {
     try
     {
         AddPartyToList(GwupeClientAppContext.CurrentAppContext.PartyManager.GetParty(username), presence);
     }
     catch (Exception e)
     {
         Logger.Error("Failed to add the username " + username + " to the roster : " + e.Message, e);
     }
 }
Example #3
0
 private void AddPartyToList(Party party, Presence presence)
 {
     var attendance = new Attendance(party);
     attendance.PropertyChanged += MarkUnmarkCurrentlyEngaged;
     if (presence != null)
     {
         attendance.SetPresence(presence);
     }
     ServicePartyAttendanceList.Add(attendance);
     ServicePartyAttendanceLookup[attendance.Party.Username] = attendance;
 }
Example #4
0
 private void AddPartyElementToList(PartyElement partyElement, RelationshipElement relationshipElement, Presence presence = null)
 {
     var party = GwupeClientAppContext.CurrentAppContext.PartyManager.AddUpdatePartyFromElement(partyElement);
     // Make sure we update the relationship
     GwupeClientAppContext.CurrentAppContext.RelationshipManager.AddUpdateRelationship(party.Username, new Relationship(relationshipElement));
     // This is to update the party in the background (avatar)
     ThreadPool.QueueUserWorkItem(state => GwupeClientAppContext.CurrentAppContext.PartyManager.GetParty(partyElement.user, true));
     // Now add it to the list
     AddPartyToList(party, presence);
 }
Example #5
0
 public void Reset()
 {
     Logger.Debug("Resetting Current User Manager, clearing current user and presence");
     _currentUser = null;
     _currentUserPresence = null;
 }
Example #6
0
 internal void SetUser(UserElement userElement, String shortCode)
 {
     CurrentUser = new Person(userElement);
     ActiveShortCode = shortCode;
     if(CurrentUserPresence == null)
     {
         CurrentUserPresence = new Presence();
     }
     CurrentUserPresence.SetIdleState(_appContext.IdleState);
     UpdatePresence(true);
     OnCurrentUserChanged(EventArgs.Empty);
 }