public void IdentityLang() { DiscoIdentity id = new DiscoIdentity(doc); Assert.IsNull(id.Lang); id.Lang = "en"; Assert.AreEqual("en", id.Lang); id.Lang = "el"; Assert.AreEqual("el", id.Lang); id.Lang = null; Assert.IsNull(id.Lang); }
// We got back our disco#info query result private void GotInfoQuery(object sender, IQ iq, object state) { // If the user clicked stop, ignore this result if (was_stopped) { return; } try { if (iq.Type == IQType.result) { DiscoInfo info = (DiscoInfo)iq.Query; // If there is an <identity> node, display the data if (info.GetIdentities().Length > 0) { DiscoIdentity i = info.GetIdentities()[0]; IdentityNameLabel.Text = i.Named.Trim(); IdentityAddressLabel.Text = iq.From.ToString(); IdentityCategoryTypeLabel.Text = string.Format("{0} - {1}", i.Category.Trim(), i.Type.Trim()); Label4.Visible = true; } // Create the actions menu button PopulateActions(iq); // Track how many responses we have gotten back TurnOffSpinner(); } else if (iq.Type == IQType.error) { GotErrorBack(iq); } } catch (Exception) { GotErrorBack(iq); MessageBox.Show(string.Format("Had a problem with Info response: {0}", iq.OuterXml)); } }
/// <summary> /// Add these identities to the node. /// Fires OnIdentities /// </summary> /// <param name="ids">Identities to add.</param> public void AddIdentities(DiscoIdentity[] ids) { if (Identity == null) Identity = new Set(); // ids may be null when used from outside. if (ids != null) { foreach (DiscoIdentity id in ids) Identity.Add(new Ident(id)); } DoCallbacks(m_identCallbacks); }
/// <summary> /// Create an identity from protocol /// </summary> /// <param name="id"></param> public Ident(DiscoIdentity id) : this(id.Named, id.Category, id.Type, id.Lang) { }