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); }
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]); }
public Account(AccountInfo info) { if (String.IsNullOrEmpty(info.User)) { throw new ArgumentNullException("user"); } if (String.IsNullOrEmpty(info.Domain)) { throw new ArgumentNullException("domain"); } if (String.IsNullOrEmpty(info.Resource)) { throw new ArgumentNullException("resource"); } m_Info = info; m_UserPresenceCache = new Dictionary <JID, Presence>(); m_Client = new JabberClient(); m_Client.AutoPresence = false; m_Client.AutoRoster = true; m_Client.AutoStartTLS = true; m_Client.OnConnect += HandleOnConnect; m_Client.OnAuthenticate += HandleOnAuthenticate; m_Client.OnDisconnect += HandleOnDisconnect; m_Client.OnError += HandleOnError; m_Client.OnPresence += HandleOnPresence; m_Client.OnInvalidCertificate += delegate { return(true); }; // XXX: m_Client.OnBeforePresenceOut += HandleOnBeforePresenceOut; m_Client.OnStreamInit += HandleOnStreamInit; m_Roster = new RosterManager(); m_Roster.OnRosterEnd += HandleOnRosterEnd; m_Roster.Stream = m_Client; m_CapsManager = new CapsManager(); m_CapsManager.Stream = m_Client; m_CapsManager.Node = "http://www.synapse.im/"; m_PubSubManager = new PubSubManager(); m_PubSubManager.Stream = m_Client; m_DiscoManager = new DiscoManager(); m_DiscoManager.Stream = m_Client; m_ConferenceManager = new ConferenceManager(); m_ConferenceManager.Stream = m_Client; m_ConferenceManager.OnInvite += HandleOnInvite; m_BookmarkManager = new BookmarkManager(); m_BookmarkManager.Stream = m_Client; m_BookmarkManager.ConferenceManager = m_ConferenceManager; m_PresenceManager = new PresenceManager(); m_PresenceManager.Stream = m_Client; m_AvatarManager = new AvatarManager(this); m_IQTracker = new IQTracker(m_Client); // XXX: Don't hard-code this. m_CapsManager.AddIdentity("Synapse 0.1", "client", "pc", "en_US"); // Create builtin features // XXX: This should be an extension point as well. AddFeature(new PersonalEventing(this)); AddFeature(new Microblogging(this)); AddFeature(new UserMood(this)); AddFeature(new UserTune(this)); AddFeature(new UserAvatars(this)); AddFeature(new ChatStates(this)); AddFeature(new UserWebIdentities(this)); if (ServiceManager.Contains <NetworkService>()) { ServiceManager.Get <NetworkService>().StateChange += HandleNetworkStateChanged; } }