public void SimpleGenerationExample() { CapsManager cm = new CapsManager(); cm.AddIdentity("client", "pc", null, "Exodus 0.9.1"); cm.AddFeature("http://jabber.org/protocol/muc"); cm.AddFeature("http://jabber.org/protocol/disco#info"); cm.AddFeature("http://jabber.org/protocol/disco#items"); Assert.AreEqual("SrFo9ar2CCk2EnOH4q4QANeuxLQ=", cm.Ver); }
/// <summary>Signin button</summary> private void btnSignin_Click(object sender, EventArgs e) { panelCredentials.Enabled = false; JID jid = new JID(txtUserName.Text); if (String.IsNullOrEmpty(jid.User)) { jabberClient.User = txtUserName.Text; jabberClient.Server = cbServer.Text.Equals(DEFAULT_SERVER) ? "gmail.com" : cbServer.Text; } else { jabberClient.User = jid.User; jabberClient.Server = jid.Server; } jabberClient.NetworkHost = cbServer.Text; jabberClient.Password = txtPassword.Text; jabberClient.AutoRoster = true; jabberClient.AutoStartTLS = true; jabberClient.AutoPresence = true; jabberClient.AutoLogin = true; jabberClient.Resource = "realjabber"; //jabberClient.PlaintextAuth = true; jabberClient.OnAuthenticate += new bedrock.ObjectHandler(jabberClient_OnAuthenticate); jabberClient.OnInvalidCertificate += new System.Net.Security.RemoteCertificateValidationCallback(jabberClient_OnInvalidCertificate); jabberClient.AddNamespace("rtt", RealTimeTextUtil.RealTimeText.NAMESPACE); jabberClient.OnIQ += new IQHandler(jabberClient_OnIQ); rosterMgr = new RosterManager(); rosterMgr.Stream = jabberClient; rosterMgr.AutoSubscribe = true; rosterMgr.AutoAllow = jabber.client.AutoSubscriptionHanding.AllowAll; rosterMgr.OnRosterBegin += new bedrock.ObjectHandler(RosterMgr_OnRosterBegin); rosterMgr.OnRosterEnd += new bedrock.ObjectHandler(RosterMgr_OnRosterEnd); rosterMgr.OnRosterItem += new RosterItemHandler(RosterMgr_OnRosterItem); rosterMgr.OnSubscription += new SubscriptionHandler(rosterMgr_OnSubscription); rosterMgr.OnUnsubscription += new UnsubscriptionHandler(rosterMgr_OnUnsubscription); discoMgr = new DiscoManager(); discoMgr.Stream = jabberClient; capsMgr = new CapsManager(); capsMgr.DiscoManager = discoMgr; capsMgr.AddFeature(RealTimeTextUtil.RealTimeText.NAMESPACE); capsMgr.Node = RealTimeTextUtil.RealTimeText.NAMESPACE; capsMgr.Stream = jabberClient; presenceMgr = new PresenceManager(); presenceMgr.Stream = jabberClient; presenceMgr.CapsManager = capsMgr; rosterTree.RosterManager = rosterMgr; rosterTree.PresenceManager = presenceMgr; rosterTree.DoubleClick += new EventHandler(rosterTree_DoubleClick); lblUser.Text = jabberClient.User; jabberClient.Connect(); }
// XXX: We probably won't need this method once we replace all this // with an extension point as mentioned above. private void AddFeature(IDiscoverable feature) { m_Features.Add(feature.GetType(), feature); foreach (string featureName in feature.FeatureNames) { m_CapsManager.AddFeature(featureName); } }
public MainForm() { // // Required for Windows Form Designer support // InitializeComponent(); // services.ImageList = roster.ImageList; cm.AddFeature(URI.TIME); cm.AddFeature(URI.VERSION); cm.AddFeature(URI.LAST); cm.AddFeature(URI.DISCO_INFO); tabControl1.TabPages.Remove(tpServices); tabControl1.TabPages.Remove(tpDebug); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; }
public void TestCaps() { PresenceManager pp = new PresenceManager(); Presence pres = new Presence(doc); pres.From = baz; CapsManager cm = new CapsManager(); pp.CapsManager = cm; cm.FileName = "caps.xml"; cm.Node = "http://cursive.net/clients/PresenceManagerTest"; cm.AddFeature(URI.DISCO_INFO); cm.AddFeature(URI.DELAY); cm.AddIdentity("client", "pc", null, "Presence Manager Test"); DiscoInfo info = new DiscoInfo(doc); cm.FillInInfo(info); cm[cm.Ver] = info; pres.AddChild(cm.GetCaps(pres.OwnerDocument)); pp.AddPresence(pres); JID dij = pp.GetFeatureJID(bare, URI.DISCO_INFO); Assert.AreEqual(baz, dij); dij = pp.GetFeatureJID(bare, URI.DISCO_ITEMS); Assert.IsNull(dij); dij = pp.GetFeatureJID(baz, URI.DISCO_INFO); Assert.AreEqual(baz, dij); StringSet fs = pp.GetFeatures(bare); Assert.IsTrue(fs[URI.DISCO_INFO]); Assert.IsFalse(fs[URI.DISCO_ITEMS]); }