/// <summary> /// will return the property meta info to be written for a given IM serviceType /// </summary> /// /// <param name="serviceType">IMServiceType to get the subproperty info for </param> /// <returns>for example GoogleTalk:xmpp, or for yahoo Yahoo:ymsgr</returns> public static string GetIMTypePropertyFull(IMServiceType serviceType) { if (lookup.ContainsKey(serviceType)) { return(lookup[serviceType]); } return(null); }
/// <summary> /// this method will return the first part of the AIM:aim , or MSN:msnim string used for writing out the property subproperty info for IMPP values /// </summary> /// <param name="serviceType">the IM service type to fetch from the dictionary</param> /// <returns>AIM or QQ or Yahoo, the first string component for the lookup of serviceTypes</returns> public static string GetIMTypePropertyPrefix(IMServiceType serviceType) { string prefix = null; if (lookup.ContainsKey(serviceType)) { string full = lookup[serviceType]; prefix = full.Substring(0, full.IndexOf(":")); } return(prefix); }
/// <summary> /// returns the xmpp or aim or ymsgr portion of the lookup for AIM:aim, Yahoo:ysmgr, etc /// </summary> /// <param name="serviceType">IMServiceType to fetch the lookup for</param> /// <returns>xmpp or msnim</returns> public static string GetIMTypePropertySuffix(IMServiceType serviceType) { string suffix = null; if (lookup.ContainsKey(serviceType)) { string full = lookup[serviceType]; suffix = full.Substring(full.IndexOf(":") + 1); } return(suffix); }
private void CheckIM(vCardIMPPCollection ims, string handle, IMServiceType serviceType, ItemType itemType, bool isPreferred) { if (ims == null || ims.Count == 0) { Assert.Fail("ims null or empty"); } var im = ims.FirstOrDefault(x => x.Handle == handle && x.ServiceType == serviceType); Assert.IsNotNull(im, "im not matched for handle " + handle + " and servicetype " + serviceType.ToString()); Assert.AreEqual(itemType, im.ItemType); Assert.AreEqual(isPreferred, im.IsPreferred); }
/// <summary> /// the handle is coming back with the msnim:handle, so we want to return the pure handle minus the msnim: /// </summary> /// <param name="serviceType"></param> /// <param name="handle"></param> /// <returns></returns> public static string StripHandlePrefix(IMServiceType serviceType, string handle) { string property = GetIMTypePropertyFull(serviceType); if (property != null) { string prefix = property.Substring(property.IndexOf(":") + 1); int prefixLength = prefix.Length + 1; if (handle.StartsWith(prefix)) { handle = handle.Substring(handle.IndexOf(prefix + ":") + prefixLength); } } return(handle); }
/// <summary> /// Creates a new <see cref="vCardIMPP"/> object with the specified handle. /// </summary> /// <param name="handle">the im handle</param> /// <param name="serviceType">skype, aim, etc</param> /// <param name="itemType">the type of IM, defaults to Unspecified</param> public vCardIMPP(string handle, IMServiceType serviceType, ItemType itemType = ItemType.UNSPECIFIED) { this.handle = handle; this.itemType = itemType; this.serviceType = serviceType; }
/// <summary> /// Creates a new <see cref="vCardIMPP"/> object. /// </summary> public vCardIMPP() { this.serviceType = IMServiceType.Unspecified; }
/// <summary> /// the handle is coming back with the msnim:handle, so we want to return the pure handle minus the msnim: /// </summary> /// <param name="serviceType"></param> /// <param name="handle"></param> /// <returns></returns> public static string StripHandlePrefix(IMServiceType serviceType, string handle) { string property = GetIMTypePropertyFull(serviceType); if (property != null) { string prefix = property.Substring(property.IndexOf(":") + 1); int prefixLength = prefix.Length + 1; if (handle.StartsWith(prefix)) { handle = handle.Substring(handle.IndexOf(prefix + ":") + prefixLength); } } return handle; }
/// <summary> /// this method will return the first part of the AIM:aim , or MSN:msnim string used for writing out the property subproperty info for IMPP values /// </summary> /// <param name="serviceType">the IM service type to fetch from the dictionary</param> /// <returns>AIM or QQ or Yahoo, the first string component for the lookup of serviceTypes</returns> public static string GetIMTypePropertyPrefix(IMServiceType serviceType) { string prefix = null; if (lookup.ContainsKey(serviceType)) { string full = lookup[serviceType]; prefix = full.Substring(0, full.IndexOf(":")); } return prefix; }
/// <summary> /// returns the xmpp or aim or ymsgr portion of the lookup for AIM:aim, Yahoo:ysmgr, etc /// </summary> /// <param name="serviceType">IMServiceType to fetch the lookup for</param> /// <returns>xmpp or msnim</returns> public static string GetIMTypePropertySuffix(IMServiceType serviceType) { string suffix = null; if (lookup.ContainsKey(serviceType)) { string full = lookup[serviceType]; suffix = full.Substring(full.IndexOf(":") + 1); } return suffix; }
/// <summary> /// will return the property meta info to be written for a given IM serviceType /// </summary> /// /// <param name="serviceType">IMServiceType to get the subproperty info for </param> /// <returns>for example GoogleTalk:xmpp, or for yahoo Yahoo:ymsgr</returns> public static string GetIMTypePropertyFull(IMServiceType serviceType) { if (lookup.ContainsKey(serviceType)) { return lookup[serviceType]; } return null; }
CheckIM(c.IMs, "yahooname", IMServiceType.Yahoo, ItemType.UNSPECIFIED, false); CheckIM(c.IMs, "fbchatname", IMServiceType.Facebook, ItemType.UNSPECIFIED, false); CheckIM(c.IMs, "jabbername", IMServiceType.Jabber, ItemType.UNSPECIFIED, false); Assert.AreEqual(4, c.SocialProfiles.Count); CheckSocialProfile(c.SocialProfiles, "nicatlinkedin", "http://www.linkedin.com/in/nicatlinkedin", SocialProfileServiceType.LinkedIn); CheckSocialProfile(c.SocialProfiles, "tiffanystone", "http://twitter.com/tiffanystone", SocialProfileServiceType.Twitter); CheckSocialProfile(c.SocialProfiles, "tiffatfacebook", "http://www.facebook.com/tiffatfacebook", SocialProfileServiceType.Facebook); CheckSocialProfile(c.SocialProfiles, "gregabedard", "http://twitter.com/gregabedard", SocialProfileServiceType.Twitter); //temp quickly vCardStandardWriter writer = new vCardStandardWriter(); using (StringWriter sw = new StringWriter())