void UpdatePollBuddy(IRTCBuddy2 buddy2) { Trace.WriteLine("Entering RTCPresence.UpdatePollBuddy"); if (this.pollDialog == null) { return; } if (buddy2 == null) { Trace.WriteLine("NULL Buddy Object"); return; } try { if (buddy2.PresentityURI != this.pollDialog.Uri && buddy2.PresentityURI != ("sip:" + pollDialog.Uri)) { Trace.WriteLine("Not Current Poll URI"); return; } this.pollDialog.Properties = RTCHelp.GetBuddyProperties(buddy2); } catch (COMException) { } }
void propertiesMenuItem_Click(object sender, System.EventArgs e) { Trace.WriteLine("Entering RTCPresence.propertiesMenuItem_Click"); RTCTreeNode node = (RTCTreeNode)(this.buddyTree.SelectedNode); IRTCBuddy2 buddy2 = (IRTCBuddy2)(node.Entity); this.ShowMessage(RTCHelp.GetBuddyProperties(buddy2), "Buddy Properties"); }
public void UpdateBuddy(IRTCBuddy2 buddy2) { Trace.WriteLine("Entering RTCPresence.UpdateBuddy"); this.UpdatePollBuddy(buddy2); if (buddy2.SubscriptionType == RTC_BUDDY_SUBSCRIPTION_TYPE.RTCBT_POLL) { return; } if (buddyHT.ContainsKey(buddy2)) { ((TreeNode)buddyHT[buddy2]).Remove(); buddyHT.Remove(buddy2); } string displayName = RTCHelp.BuildBuddyDisplayName(buddy2); if (displayName == null || displayName.Length == 0) { Trace.WriteLine("NULL Buddy Name"); return; } Trace.WriteLine("Display name: " + displayName); RTCTreeNode buddyNode = new RTCTreeNode(displayName, buddy2); if (buddy2.Status == RTC_PRESENCE_STATUS.RTCXS_PRESENCE_OFFLINE) { buddyTree.Nodes[0].Nodes.Add(buddyNode); buddyTree.Nodes[0].Expand(); } else { buddyTree.Nodes[1].Nodes.Add(buddyNode); buddyTree.Nodes[1].Expand(); } buddyHT.Add(buddy2, buddyNode); ArrayList deviceDisplayNameList = RTCHelp.BuildDeviceDisplayNameList(buddy2); foreach (string deviceDisplayName in deviceDisplayNameList) { TreeNode deviceNode = new TreeNode(deviceDisplayName); buddyNode.Nodes.Add(deviceNode); } buddyNode.Expand(); }
public static string BuildBuddyDisplayName(IRTCBuddy2 buddy2) { Trace.WriteLine("Entering RTCHelp.BuildBuddyDisplayName"); RTC_PRESENCE_STATUS presenceStatus = buddy2.Status; string name = RTCHelp.GetBuddyName(buddy2); if (name == null || name.Length == 0) { Trace.WriteLine("NULL Buddy Name"); return(null); } return(RTCHelp.BuildDisplayName(name, presenceStatus)); }
public static ArrayList BuildDeviceDisplayNameList(IRTCBuddy2 buddy2) { Trace.WriteLine("Entering RTCHelp.BuildDeviceDisplayNameList"); ArrayList deviceList = new ArrayList(); string deviceName; RTC_PRESENCE_STATUS deviceStatus; try { IRTCCollection deviceCollection = buddy2.PresenceDevices; foreach (IRTCPresenceDevice device in deviceCollection) { try { deviceName = device.get_PresenceProperty(RTC_PRESENCE_PROPERTY.RTCPP_DEVICE_NAME); } catch (COMException) { deviceName = "NOT EXIST"; Trace.WriteLine("NULL Device Name"); continue; } try { deviceStatus = device.Status; } catch (COMException) { deviceStatus = RTC_PRESENCE_STATUS.RTCXS_PRESENCE_OFFLINE; } string deviceDisplayName = RTCHelp.BuildDisplayName(deviceName, deviceStatus); deviceList.Add(deviceDisplayName); } } catch (COMException) { return(null); } return(deviceList); }
void OnRTCBuddyEvent(IRTCBuddyEvent2 buddyEvent) { Trace.WriteLine("Entering RTCPresenceCore.OnRTCBuddyEvent " + buddyEvent.EventType); int statusCode = buddyEvent.StatusCode; IRTCBuddy2 buddy2 = (IRTCBuddy2)buddyEvent.Buddy; switch (buddyEvent.EventType) { case RTC_BUDDY_EVENT_TYPE.RTCBET_BUDDY_ADD: //This buddy's properties have been added. if (RTCHelp.IsSucceeded(statusCode)) { this.presenceUI.UpdateBuddy(buddy2); } break; case RTC_BUDDY_EVENT_TYPE.RTCBET_BUDDY_REMOVE: //This buddy has been successfully removed from the buddy list. this.presenceUI.RemoveBuddy(buddy2); break; case RTC_BUDDY_EVENT_TYPE.RTCBET_BUDDY_UPDATE: //This buddy's properties have been updated. -- ignore break; case RTC_BUDDY_EVENT_TYPE.RTCBET_BUDDY_SUBSCRIBED: //This buddy's presence information is subscribed to -- ignore break; case RTC_BUDDY_EVENT_TYPE.RTCBET_BUDDY_STATE_CHANGE: //This buddy's presence state has changed. this.presenceUI.UpdateBuddy(buddy2); break; default: break; } }
void OnRTCProfileEvent(IRTCProfileEvent2 profileEvent) { Trace.WriteLine("Entering RTCPresenceCore.OnRTCProfileEvent " + profileEvent.EventType); if (profileEvent.EventType == RTC_PROFILE_EVENT_TYPE.RTCPFET_PROFILE_GET) { if (RTCHelp.IsSucceeded(profileEvent.StatusCode)) { this.profile = (IRTCProfile2)profileEvent.Profile; this.profile.AllowedAuth = RTCConst.RTCAU_USE_LOGON_CRED | RTCConst.RTCAU_NTLM | RTCConst.RTCAU_KERBEROS; this.DoRegister(); } else { this.DoDisablePresence(); this.presenceUI.OnLoggedOff(); this.presenceUI.ShowMessage("Logon failed!", "Warning"); } } }