public void OnBeforePresenceOutTest() { IEventRaiser presHandler; using (mocks.Record()) { stream.OnBeforePresenceOut += null; presHandler = LastCall.IgnoreArguments().GetEventRaiser(); } using (mocks.Playback()) { CapsManager cm = new CapsManager(); cm.Stream = stream; cm.Node = NODE; Presence packet = CreatePresencePacket(); presHandler.Raise(new object[] { null, packet }); string original = packet.OuterXml.Replace(" ", ""); string comparison = GetPresenceWithCaps(cm.Ver).Replace(" ", ""); Assert.IsTrue(original == comparison); } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); jabber.connection.Ident ident2 = new jabber.connection.Ident(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.sb = new System.Windows.Forms.StatusBar(); this.pnlCon = new System.Windows.Forms.StatusBarPanel(); this.pnlSSL = new System.Windows.Forms.StatusBarPanel(); this.pnlPresence = new System.Windows.Forms.StatusBarPanel(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tpRoster = new System.Windows.Forms.TabPage(); this.roster = new muzzle.RosterTree(); this.jc = new jabber.client.JabberClient(this.components); this.pm = new jabber.client.PresenceManager(this.components); this.cm = new jabber.connection.CapsManager(this.components); this.dm = new jabber.connection.DiscoManager(this.components); this.rm = new jabber.client.RosterManager(this.components); this.tpServices = new System.Windows.Forms.TabPage(); this.services = new Example.ServiceDisplay(); this.tpBookmarks = new System.Windows.Forms.TabPage(); this.lvBookmarks = new System.Windows.Forms.ListView(); this.chName = new System.Windows.Forms.ColumnHeader(); this.chNick = new System.Windows.Forms.ColumnHeader(); this.chAutoJoin = new System.Windows.Forms.ColumnHeader(); this.tpDebug = new System.Windows.Forms.TabPage(); this.debug = new muzzle.XmppDebugger(); this.mnuPresence = new System.Windows.Forms.ContextMenu(); this.mnuAvailable = new System.Windows.Forms.MenuItem(); this.mnuAway = new System.Windows.Forms.MenuItem(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.connectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.joinConferenceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.servicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.rosterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addContactToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeContactToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addGroupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.bookmarkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.closeTabToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pubSubToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.subscribePubSubToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deletePubSubToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.psm = new jabber.connection.PubSubManager(this.components); this.idler = new bedrock.util.IdleTime(); this.muc = new jabber.connection.ConferenceManager(this.components); this.bmm = new jabber.client.BookmarkManager(this.components); ((System.ComponentModel.ISupportInitialize)(this.pnlCon)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pnlSSL)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pnlPresence)).BeginInit(); this.tabControl1.SuspendLayout(); this.tpRoster.SuspendLayout(); this.tpServices.SuspendLayout(); this.tpBookmarks.SuspendLayout(); this.tpDebug.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // // sb // this.sb.Location = new System.Drawing.Point(0, 416); this.sb.Name = "sb"; this.sb.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { this.pnlCon, this.pnlSSL, this.pnlPresence}); this.sb.ShowPanels = true; this.sb.Size = new System.Drawing.Size(632, 22); this.sb.TabIndex = 0; this.sb.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.sb_PanelClick); // // pnlCon // this.pnlCon.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; this.pnlCon.Name = "pnlCon"; this.pnlCon.Text = "Click on \"Offline\", and select a presence to log in."; this.pnlCon.Width = 538; // // pnlSSL // this.pnlSSL.Alignment = System.Windows.Forms.HorizontalAlignment.Center; this.pnlSSL.Name = "pnlSSL"; this.pnlSSL.Width = 30; // // pnlPresence // this.pnlPresence.Alignment = System.Windows.Forms.HorizontalAlignment.Right; this.pnlPresence.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents; this.pnlPresence.Name = "pnlPresence"; this.pnlPresence.Text = "Offline"; this.pnlPresence.Width = 47; // // tabControl1 // this.tabControl1.Controls.Add(this.tpRoster); this.tabControl1.Controls.Add(this.tpServices); this.tabControl1.Controls.Add(this.tpBookmarks); this.tabControl1.Controls.Add(this.tpDebug); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Location = new System.Drawing.Point(0, 24); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(632, 392); this.tabControl1.TabIndex = 2; // // tpRoster // this.tpRoster.Controls.Add(this.roster); this.tpRoster.Location = new System.Drawing.Point(4, 22); this.tpRoster.Name = "tpRoster"; this.tpRoster.Size = new System.Drawing.Size(624, 366); this.tpRoster.TabIndex = 1; this.tpRoster.Text = "Roster"; this.tpRoster.UseVisualStyleBackColor = true; // // roster // this.roster.AllowDrop = true; this.roster.Client = this.jc; this.roster.Dock = System.Windows.Forms.DockStyle.Fill; this.roster.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText; this.roster.ImageIndex = 1; this.roster.Location = new System.Drawing.Point(0, 0); this.roster.Name = "roster"; this.roster.PresenceManager = this.pm; this.roster.RosterManager = this.rm; this.roster.SelectedImageIndex = 0; this.roster.ShowLines = false; this.roster.ShowRootLines = false; this.roster.Size = new System.Drawing.Size(624, 366); this.roster.Sorted = true; this.roster.StatusColor = System.Drawing.Color.Teal; this.roster.TabIndex = 0; this.roster.DoubleClick += new System.EventHandler(this.roster_DoubleClick); // // jc // this.jc.AutoReconnect = 3F; this.jc.AutoStartCompression = true; this.jc.AutoStartTLS = true; this.jc.InvokeControl = this; this.jc.KeepAlive = 30F; this.jc.LocalCertificate = null; this.jc.Password = null; this.jc.User = null; this.jc.OnRegisterInfo += new jabber.client.RegisterInfoHandler(this.jc_OnRegisterInfo); this.jc.OnError += new bedrock.ExceptionHandler(this.jc_OnError); this.jc.OnIQ += new jabber.client.IQHandler(this.jc_OnIQ); this.jc.OnAuthenticate += new bedrock.ObjectHandler(this.jc_OnAuthenticate); this.jc.OnStreamError += new jabber.protocol.ProtocolHandler(this.jc_OnStreamError); this.jc.OnConnect += new jabber.connection.StanzaStreamHandler(this.jc_OnConnect); this.jc.OnDisconnect += new bedrock.ObjectHandler(this.jc_OnDisconnect); this.jc.OnAuthError += new jabber.protocol.ProtocolHandler(this.jc_OnAuthError); this.jc.OnRegistered += new jabber.client.IQHandler(this.jc_OnRegistered); this.jc.OnMessage += new jabber.client.MessageHandler(this.jc_OnMessage); // // pm // this.pm.CapsManager = this.cm; this.pm.OverrideFrom = null; this.pm.Stream = this.jc; // // cm // this.cm.DiscoManager = this.dm; this.cm.Features = new string[0]; this.cm.FileName = "caps.xml"; ident2.Category = "client"; ident2.Lang = "en"; ident2.Name = "Jabber-Net Test Client"; ident2.Type = "pc"; this.cm.Identities = new jabber.connection.Ident[] { ident2}; this.cm.Node = "http://cursive.net/clients/csharp-example"; this.cm.OverrideFrom = null; this.cm.Stream = this.jc; // // dm // this.dm.OverrideFrom = null; this.dm.Stream = this.jc; // // rm // this.rm.AutoAllow = jabber.client.AutoSubscriptionHanding.AllowIfSubscribed; this.rm.AutoSubscribe = true; this.rm.OverrideFrom = null; this.rm.Stream = this.jc; this.rm.OnRosterEnd += new bedrock.ObjectHandler(this.rm_OnRosterEnd); this.rm.OnSubscription += new jabber.client.SubscriptionHandler(this.rm_OnSubscription); this.rm.OnUnsubscription += new jabber.client.UnsubscriptionHandler(this.rm_OnUnsubscription); // // tpServices // this.tpServices.Controls.Add(this.services); this.tpServices.Location = new System.Drawing.Point(4, 22); this.tpServices.Name = "tpServices"; this.tpServices.Size = new System.Drawing.Size(624, 366); this.tpServices.TabIndex = 2; this.tpServices.Text = "Services"; this.tpServices.UseVisualStyleBackColor = true; // // services // this.services.DiscoManager = this.dm; this.services.Dock = System.Windows.Forms.DockStyle.Fill; this.services.ImageList = null; this.services.Location = new System.Drawing.Point(0, 0); this.services.Name = "services"; this.services.Size = new System.Drawing.Size(624, 366); this.services.Stream = this.jc; this.services.TabIndex = 0; // // tpBookmarks // this.tpBookmarks.Controls.Add(this.lvBookmarks); this.tpBookmarks.Location = new System.Drawing.Point(4, 22); this.tpBookmarks.Name = "tpBookmarks"; this.tpBookmarks.Size = new System.Drawing.Size(624, 366); this.tpBookmarks.TabIndex = 3; this.tpBookmarks.Text = "Bookmarks"; this.tpBookmarks.UseVisualStyleBackColor = true; // // lvBookmarks // this.lvBookmarks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.chName, this.chNick, this.chAutoJoin}); this.lvBookmarks.Dock = System.Windows.Forms.DockStyle.Fill; this.lvBookmarks.Location = new System.Drawing.Point(0, 0); this.lvBookmarks.Name = "lvBookmarks"; this.lvBookmarks.Size = new System.Drawing.Size(624, 366); this.lvBookmarks.Sorting = System.Windows.Forms.SortOrder.Ascending; this.lvBookmarks.TabIndex = 0; this.lvBookmarks.UseCompatibleStateImageBehavior = false; this.lvBookmarks.View = System.Windows.Forms.View.Details; this.lvBookmarks.DoubleClick += new System.EventHandler(this.lvBookmarks_DoubleClick); this.lvBookmarks.KeyUp += new System.Windows.Forms.KeyEventHandler(this.lvBookmarks_KeyUp); // // chName // this.chName.Text = "Room"; this.chName.Width = 198; // // chNick // this.chNick.Text = "Nick"; this.chNick.Width = 88; // // chAutoJoin // this.chAutoJoin.Text = "AutoJoin"; // // tpDebug // this.tpDebug.Controls.Add(this.debug); this.tpDebug.Location = new System.Drawing.Point(4, 22); this.tpDebug.Name = "tpDebug"; this.tpDebug.Size = new System.Drawing.Size(624, 366); this.tpDebug.TabIndex = 0; this.tpDebug.Text = "Debug"; this.tpDebug.UseVisualStyleBackColor = true; // // debug // this.debug.Dock = System.Windows.Forms.DockStyle.Fill; this.debug.ErrorColor = System.Drawing.Color.Red; this.debug.Location = new System.Drawing.Point(0, 0); this.debug.Name = "debug"; this.debug.OtherColor = System.Drawing.Color.Green; this.debug.OverrideFrom = null; this.debug.ReceiveColor = System.Drawing.Color.Orange; this.debug.SendColor = System.Drawing.Color.Blue; this.debug.Size = new System.Drawing.Size(624, 366); this.debug.Stream = this.jc; this.debug.TabIndex = 0; this.debug.TextColor = System.Drawing.Color.Black; // // mnuPresence // this.mnuPresence.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuAvailable, this.mnuAway}); // // mnuAvailable // this.mnuAvailable.Enabled = false; this.mnuAvailable.Index = 0; this.mnuAvailable.Shortcut = System.Windows.Forms.Shortcut.CtrlO; this.mnuAvailable.Text = "&Available"; this.mnuAvailable.Click += new System.EventHandler(this.mnuAvailable_Click); // // mnuAway // this.mnuAway.Enabled = false; this.mnuAway.Index = 1; this.mnuAway.Shortcut = System.Windows.Forms.Shortcut.CtrlA; this.mnuAway.Text = "A&way"; this.mnuAway.Click += new System.EventHandler(this.mnuAway_Click); // // menuStrip1 // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.viewToolStripMenuItem, this.rosterToolStripMenuItem, this.bookmarkToolStripMenuItem, this.windowToolStripMenuItem, this.pubSubToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(632, 24); this.menuStrip1.TabIndex = 3; this.menuStrip1.Text = "menuStrip1"; // // fileToolStripMenuItem // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.connectToolStripMenuItem, this.joinConferenceToolStripMenuItem, this.toolStripMenuItem1, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); this.fileToolStripMenuItem.Text = "&File"; // // connectToolStripMenuItem // this.connectToolStripMenuItem.Name = "connectToolStripMenuItem"; this.connectToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F9; this.connectToolStripMenuItem.Size = new System.Drawing.Size(200, 22); this.connectToolStripMenuItem.Text = "&Connect"; this.connectToolStripMenuItem.Click += new System.EventHandler(this.connectToolStripMenuItem_Click); // // joinConferenceToolStripMenuItem // this.joinConferenceToolStripMenuItem.Name = "joinConferenceToolStripMenuItem"; this.joinConferenceToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.J))); this.joinConferenceToolStripMenuItem.Size = new System.Drawing.Size(200, 22); this.joinConferenceToolStripMenuItem.Text = "&Join Conference"; this.joinConferenceToolStripMenuItem.Click += new System.EventHandler(this.joinConferenceToolStripMenuItem_Click); // // toolStripMenuItem1 // this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Size = new System.Drawing.Size(197, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q))); this.exitToolStripMenuItem.Size = new System.Drawing.Size(200, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // // viewToolStripMenuItem // this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.servicesToolStripMenuItem, this.debugToolStripMenuItem}); this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; this.viewToolStripMenuItem.Size = new System.Drawing.Size(41, 20); this.viewToolStripMenuItem.Text = "&View"; // // servicesToolStripMenuItem // this.servicesToolStripMenuItem.Name = "servicesToolStripMenuItem"; this.servicesToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F8; this.servicesToolStripMenuItem.Size = new System.Drawing.Size(144, 22); this.servicesToolStripMenuItem.Text = "&Services"; this.servicesToolStripMenuItem.Click += new System.EventHandler(this.servicesToolStripMenuItem_Click); // // debugToolStripMenuItem // this.debugToolStripMenuItem.Name = "debugToolStripMenuItem"; this.debugToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F12; this.debugToolStripMenuItem.Size = new System.Drawing.Size(144, 22); this.debugToolStripMenuItem.Text = "&Debug"; this.debugToolStripMenuItem.Click += new System.EventHandler(this.debugToolStripMenuItem_Click); // // rosterToolStripMenuItem // this.rosterToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addContactToolStripMenuItem, this.removeContactToolStripMenuItem, this.addGroupToolStripMenuItem}); this.rosterToolStripMenuItem.Name = "rosterToolStripMenuItem"; this.rosterToolStripMenuItem.Size = new System.Drawing.Size(51, 20); this.rosterToolStripMenuItem.Text = "&Roster"; // // addContactToolStripMenuItem // this.addContactToolStripMenuItem.Name = "addContactToolStripMenuItem"; this.addContactToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Insert; this.addContactToolStripMenuItem.Size = new System.Drawing.Size(187, 22); this.addContactToolStripMenuItem.Text = "&Add Contact"; this.addContactToolStripMenuItem.Click += new System.EventHandler(this.menuItem3_Click); // // removeContactToolStripMenuItem // this.removeContactToolStripMenuItem.Name = "removeContactToolStripMenuItem"; this.removeContactToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete; this.removeContactToolStripMenuItem.Size = new System.Drawing.Size(187, 22); this.removeContactToolStripMenuItem.Text = "&Remove Contact"; this.removeContactToolStripMenuItem.Click += new System.EventHandler(this.menuItem5_Click); // // addGroupToolStripMenuItem // this.addGroupToolStripMenuItem.Name = "addGroupToolStripMenuItem"; this.addGroupToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G))); this.addGroupToolStripMenuItem.Size = new System.Drawing.Size(187, 22); this.addGroupToolStripMenuItem.Text = "&Add Group"; this.addGroupToolStripMenuItem.Click += new System.EventHandler(this.addGroupToolStripMenuItem_Click); // // bookmarkToolStripMenuItem // this.bookmarkToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addToolStripMenuItem, this.removeToolStripMenuItem}); this.bookmarkToolStripMenuItem.Name = "bookmarkToolStripMenuItem"; this.bookmarkToolStripMenuItem.Size = new System.Drawing.Size(65, 20); this.bookmarkToolStripMenuItem.Text = "Bookmark"; // // addToolStripMenuItem // this.addToolStripMenuItem.Name = "addToolStripMenuItem"; this.addToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B))); this.addToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.addToolStripMenuItem.Text = "Add"; this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click); // // removeToolStripMenuItem // this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; this.removeToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.B))); this.removeToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.removeToolStripMenuItem.Text = "Remove"; this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); // // windowToolStripMenuItem // this.windowToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.closeTabToolStripMenuItem}); this.windowToolStripMenuItem.Name = "windowToolStripMenuItem"; this.windowToolStripMenuItem.Size = new System.Drawing.Size(57, 20); this.windowToolStripMenuItem.Text = "&Window"; // // closeTabToolStripMenuItem // this.closeTabToolStripMenuItem.Name = "closeTabToolStripMenuItem"; this.closeTabToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W))); this.closeTabToolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.closeTabToolStripMenuItem.Text = "&Close Tab"; this.closeTabToolStripMenuItem.Click += new System.EventHandler(this.closeTabToolStripMenuItem_Click); // // pubSubToolStripMenuItem // this.pubSubToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.subscribePubSubToolStripMenuItem, this.deletePubSubToolStripMenuItem}); this.pubSubToolStripMenuItem.Name = "pubSubToolStripMenuItem"; this.pubSubToolStripMenuItem.Size = new System.Drawing.Size(55, 20); this.pubSubToolStripMenuItem.Text = "PubSub"; // // subscribePubSubToolStripMenuItem // this.subscribePubSubToolStripMenuItem.Name = "subscribePubSubToolStripMenuItem"; this.subscribePubSubToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F10; this.subscribePubSubToolStripMenuItem.Size = new System.Drawing.Size(156, 22); this.subscribePubSubToolStripMenuItem.Text = "&Subscribe"; this.subscribePubSubToolStripMenuItem.Click += new System.EventHandler(this.subscribeToPubSubToolStripMenuItem_Click); // // deletePubSubToolStripMenuItem // this.deletePubSubToolStripMenuItem.Name = "deletePubSubToolStripMenuItem"; this.deletePubSubToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F11; this.deletePubSubToolStripMenuItem.Size = new System.Drawing.Size(156, 22); this.deletePubSubToolStripMenuItem.Text = "&Delete"; this.deletePubSubToolStripMenuItem.Click += new System.EventHandler(this.deletePubSubToolStripMenuItem_Click); // // psm // this.psm.OverrideFrom = null; this.psm.Stream = this.jc; // // idler // this.idler.InvokeControl = this; this.idler.OnIdle += new bedrock.util.SpanEventHandler(this.idler_OnIdle); this.idler.OnUnIdle += new bedrock.util.SpanEventHandler(this.idler_OnUnIdle); // // muc // this.muc.OverrideFrom = null; this.muc.Stream = this.jc; // // bmm // this.bmm.ConferenceManager = this.muc; this.bmm.OverrideFrom = null; this.bmm.Stream = this.jc; this.bmm.OnConferenceAdd += new jabber.client.BookmarkConferenceDelegate(this.bmm_OnConferenceAdd); this.bmm.OnConferenceRemove += new jabber.client.BookmarkConferenceDelegate(this.bmm_OnConferenceRemove); // // MainForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(632, 438); this.ContextMenu = this.mnuPresence; this.Controls.Add(this.tabControl1); this.Controls.Add(this.sb); this.Controls.Add(this.menuStrip1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip1; this.Name = "MainForm"; this.Text = "MainForm"; this.Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_Closing); ((System.ComponentModel.ISupportInitialize)(this.pnlCon)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pnlSSL)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pnlPresence)).EndInit(); this.tabControl1.ResumeLayout(false); this.tpRoster.ResumeLayout(false); this.tpServices.ResumeLayout(false); this.tpBookmarks.ResumeLayout(false); this.tpDebug.ResumeLayout(false); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); }
public JID GetFeatureJID(CapsManager caps, string featureURI) { gen.LinkedListNode<Presence> n; for (n = m_all.Last; n != null; n = n.Previous) { StringSet f = GetFeatures(caps, n.Value); if ((f != null) && f.Contains(featureURI)) return n.Value.From; } return null; }
public StringSet GetAllFeatures(CapsManager caps) { if (caps == null) throw new ArgumentNullException("caps"); StringSet features = new StringSet(); foreach (Presence p in m_all) { StringSet f = GetFeatures(caps, p); if (f != null) features.Add(f); } return features; }
public StringSet GetFeatures(CapsManager caps, string resource) { if (resource == null) return GetAllFeatures(caps); return GetFeatures(caps, this[resource]); }
private StringSet GetFeatures(CapsManager caps, Presence p) { if (p == null) return null; Caps c = p.GetChildElement<Caps>(); if (c == null) return null; DiscoInfo di = caps[c.Version]; if (di == null) return null; return di.FeatureSet; }
/// <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(); }
public void Connect(bool initialPresence) { this.jabberClient = new JabberClient(); this.jabberClient.OnReadText += this.InternalOnReadText; this.jabberClient.OnWriteText += this.InternalOnWriteText; this.jabberClient.OnError += new ExceptionHandler(this.OnError); this.jabberClient.OnStreamError += new jabber.protocol.ProtocolHandler(this.OnStreamError); var jid = new JID(this.username); this.jabberClient.User = jid.User; this.jabberClient.Server = jid.Server; this.jabberClient.NetworkHost = this.host; this.jabberClient.Port = this.port; this.jabberClient.Resource = "Hangout Phone"; this.jabberClient.Password = this.password; this.jabberClient.AutoStartTLS = true; this.jabberClient.AutoPresence = initialPresence; this.jabberClient.AutoReconnect = 3f; this.capabilityManager = new CapsManager { Stream = this.jabberClient, Node = "http://rankida.com" }; this.jabberClient.Connect(); }
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 Class1(string[] args) { JabberClient jc = new JabberClient(); jc.OnReadText += new bedrock.TextHandler(jc_OnReadText); jc.OnWriteText += new bedrock.TextHandler(jc_OnWriteText); jc.OnError +=new bedrock.ExceptionHandler(jc_OnError); jc.OnStreamError += new jabber.protocol.ProtocolHandler(jc_OnStreamError); jc.AutoReconnect = 3f; GetOpt go = new GetOpt(this); try { go.Process(args); } catch (ArgumentException) { go.UsageExit(); } if (untrustedOK) jc.OnInvalidCertificate += new System.Net.Security.RemoteCertificateValidationCallback(jc_OnInvalidCertificate); JID j = new JID(jid); jc.User = j.User; jc.Server = j.Server; jc.NetworkHost = networkHost; jc.Port = port; jc.Resource = "Jabber.Net Console Client"; jc.Password = pass; jc.AutoStartTLS = TLS; jc.AutoPresence = initialPresence; if (certificateFile != null) { jc.SetCertificateFile(certificateFile, certificatePass); Console.WriteLine(jc.LocalCertificate.ToString(true)); } if (boshURL != null) { jc[Options.POLL_URL] = boshURL; jc[Options.CONNECTION_TYPE] = ConnectionType.HTTP_Binding; } if (register) { jc.AutoLogin = false; jc.OnLoginRequired += new bedrock.ObjectHandler(jc_OnLoginRequired); jc.OnRegisterInfo += new RegisterInfoHandler(this.jc_OnRegisterInfo); jc.OnRegistered += new IQHandler(jc_OnRegistered); } CapsManager cm = new CapsManager(); cm.Stream = jc; cm.Node = "http://cursive.net/clients/ConsoleClient"; Console.WriteLine("Connecting"); jc.Connect(); Console.WriteLine("Connected"); string line; while ((line = Console.ReadLine()) != null) { if (line == "/clear") { // Hm.... I wonder if this works on windows. Console.Write("\x1b[H\x1b[2J"); continue; } if ((line == "/q") || (line == "/quit")) { jc.Close(); break; } if (line.Trim() == "") { continue; } try { if (line == "</stream:stream>") { jc.Write(line); } else { // TODO: deal with stanzas that span lines... keep // parsing until we have a full "doc". XmlDocument doc = new XmlDocument(); doc.LoadXml(line); XmlElement elem = doc.DocumentElement; if (elem != null) jc.Write(elem); } } catch (XmlException ex) { Console.WriteLine("Invalid XML: " + ex.Message); } } }
public Class1(string[] args) { JabberClient m_jc = new JabberClient(); m_jc.OnReadText += new bedrock.TextHandler(jc_OnReadText); m_jc.OnWriteText += new bedrock.TextHandler(jc_OnWriteText); m_jc.OnError +=new bedrock.ExceptionHandler(jc_OnError); m_jc.OnStreamError += new jabber.protocol.ProtocolHandler(jc_OnStreamError); m_jc.AutoReconnect = 3f; m_jc.Resource = "StagePresence"; m_jc.AutoPresence = false;//true;//HACK: initialPresence; // connect over a BOSH stuff m_jc.Server = "chat-test.vix.tv"; m_jc.NetworkHost = "chat-test.vix.tv"; m_jc.Port = 443; m_jc[Options.POLL_URL] = "https://chat.vix.tv/http-bind/"; // Set server based on BOSH URL Uri uri = new Uri(m_jc[Options.POLL_URL].ToString()); m_jc.Server = uri.Host; m_jc[Options.CONNECTION_TYPE] = ConnectionType.HTTP_Binding; m_jc[Options.ANONYMOUS] = true; m_jc[Options.AUTO_ROSTER] = false; CapsManager cm = new CapsManager(); cm.Stream = m_jc; cm.Node = "http://vix.tv"; Console.WriteLine("Connecting"); m_jc.Connect(); Console.WriteLine("Connected"); //GetOpt go = new GetOpt(this); //try //{ // go.Process(args); //} //catch (ArgumentException) //{ // go.UsageExit(); //} //if (untrustedOK) // jc.OnInvalidCertificate += new System.Net.Security.RemoteCertificateValidationCallback(jc_OnInvalidCertificate); //JID j = new JID(jid); //jc.User = j.User; //jc.Server = j.Server; //jc.NetworkHost = networkHost; //jc.Port = port; //jc.Resource = "Jabber.Net Console Client"; //jc.Password = pass; //jc.AutoStartTLS = TLS; //jc.AutoPresence = initialPresence; //if (certificateFile != null) //{ // jc.SetCertificateFile(certificateFile, certificatePass); // Console.WriteLine(jc.LocalCertificate.ToString(true)); //} //if (boshURL != null) //{ // jc[Options.POLL_URL] = boshURL; // jc[Options.CONNECTION_TYPE] = ConnectionType.HTTP_Binding; // Uri uri = new Uri(jc[Options.POLL_URL].ToString()); // jc.Server = uri.Host; // jc[Options.ANONYMOUS] = true; // jc[Options.AUTO_ROSTER] = false; //} //if (register) //{ // jc.AutoLogin = false; // jc.OnLoginRequired += // new bedrock.ObjectHandler(jc_OnLoginRequired); // jc.OnRegisterInfo += new RegisterInfoHandler(this.jc_OnRegisterInfo); // jc.OnRegistered += new IQHandler(jc_OnRegistered); //} //CapsManager cm = new CapsManager(); //cm.Stream = jc; //cm.Node = "http://vix.tv"; //Console.WriteLine("Connecting"); //jc.Connect(); //Console.WriteLine("Connected"); //while (true) //{ // //} string line; while ((line = Console.ReadLine()) != null) { if (line == "/clear") { // Hm.... I wonder if this works on windows. Console.Write("\x1b[H\x1b[2J"); continue; } if ((line == "/q") || (line == "/quit")) { m_jc.Close(); break; } if (line.Trim() == "") { continue; } try { if (line == "</stream:stream>") { m_jc.Write(line); } else { // TODO: deal with stanzas that span lines... keep // parsing until we have a full "doc". XmlDocument doc = new XmlDocument(); doc.LoadXml(line); XmlElement elem = doc.DocumentElement; if (elem != null) m_jc.Write(elem); } } catch (XmlException ex) { Console.WriteLine("Invalid XML: " + ex.Message); } } }
public void IqRequestTest() { string nodever = ""; IEventRaiser iqEvent; using (mocks.Record()) { stream.OnIQ += null; iqEvent = LastCall.IgnoreArguments().GetEventRaiser(); Expect.Call(stream.Document).Return(doc); stream.Write((XmlElement)null); LastCall.Callback((Func<XmlElement, bool>) delegate(XmlElement arg0) { string original = arg0.OuterXml.Replace(" ", ""); string comparison = GetIQResponse(nodever).Replace(" ", ""); return original == comparison; }); } using (mocks.Playback()) { CapsManager cm = new CapsManager(); cm.Stream = stream; cm.Node = NODE; nodever = cm.NodeVer; iqEvent.Raise(new object[] { null, CreateIqRequest() }); } }
public void ComplexGenerationExample() { XmlDocument doc = new XmlDocument(); doc.LoadXml("<book xml:lang='en'/>"); XmlElement book = doc.DocumentElement; foreach (XmlAttribute attr in book.Attributes) { System.Console.WriteLine(attr.Name); } XmlElement root = doc.DocumentElement; DiscoInfo info = new DiscoInfo(doc); info.AddFeature("http://jabber.org/protocol/muc"); info.AddFeature("http://jabber.org/protocol/disco#info"); info.AddFeature("http://jabber.org/protocol/disco#items"); info.AddIdentity("client", "pc", "Psi 0.9.1", "en"); info.AddIdentity("client", "pc", "\u03a8 0.9.1", "el"); Data x = info.CreateExtension(); x.FormType = "urn:xmpp:dataforms:softwareinfo"; x.AddField("ip_version").Vals = new string[] { "ipv4", "ipv6" }; x.AddField("os").Val = "Mac"; x.AddField("os_version").Val = "10.5.1"; x.AddField("software").Val = "Psi"; x.AddField("software_version").Val = "0.11"; DiscoNode dn = new DiscoNode(new JID(null, "placeholder", null), null); dn.AddInfo(info); CapsManager cm = new CapsManager(dn); Assert.AreEqual("8lu+88MRxmKM7yO3MEzY7YmTsWs=", cm.Ver); }
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); }