예제 #1
0
        /// <summary>
        /// Notify application when the contact state has changed.
        /// Application may then query the contact info to get the details.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _pjContact_OnBuddyState(object sender, EventArgs e)
        {
            ContactInfo contactInfo = new ContactInfo();

            contactInfo.PresenceStatus = new PresenceStatus();

            // Get the contact info.
            using (pjsua2.BuddyInfo pjContactInfo = _pjContact.getInfo())
            {
                contactInfo.Info = pjContactInfo.contact;
                contactInfo.PresMonitorEnabled = pjContactInfo.presMonitorEnabled;
                contactInfo.SubState           = OnMwiInfoParam.GetSubscriptionState(pjContactInfo.subState);
                contactInfo.SubStateName       = pjContactInfo.subStateName;
                contactInfo.SubTermCode        = AccountInfo.GetStatusCodeEx(pjContactInfo.subTermCode);
                contactInfo.SubTermReason      = pjContactInfo.subTermReason;
                contactInfo.Uri = pjContactInfo.uri;

                if (pjContactInfo.presStatus != null)
                {
                    contactInfo.PresenceStatus.Activity   = PresenceStatus.GetActivityEx(pjContactInfo.presStatus.activity);
                    contactInfo.PresenceStatus.Note       = pjContactInfo.presStatus.note;
                    contactInfo.PresenceStatus.RpidId     = pjContactInfo.presStatus.rpidId;
                    contactInfo.PresenceStatus.Status     = PresenceStatus.GetContactStatusEx(pjContactInfo.presStatus.status);
                    contactInfo.PresenceStatus.StatusText = pjContactInfo.presStatus.statusText;
                }
            }

            // Invoke the call back event.
            OnContactState?.Invoke(this, contactInfo);
        }
예제 #2
0
 /// <summary>
 /// Notify application when the contact state has changed.
 /// Application may then query the contact info to get the details.
 /// </summary>
 /// <param name="sender">The current sender.</param>
 /// <param name="e">The event parameter.</param>
 private void Contact_OnContactState(object sender, ContactInfo e)
 {
     OnContactState?.Invoke(this, e);
 }