private void m_node_OnItemAdd(PubSubNode node, Jabber.Protocol.IQ.PubSubItem item) { // OnItemRemove should have fired first, so no reason to remove it here. // Hopefully. Debug.Assert(lbID.Items.IndexOf(item.ID) == -1); lbID.Items.Add(item.ID); }
/// <summary> /// Create an x:data form from the given iq stanza. /// </summary> /// <param name="parent">Original stanza</param> public XDataForm(Jabber.Protocol.Client.IQ parent) : this(FindData(parent)) { m_stanza = (Packet)parent.CloneNode(true); Data d = FindData(m_stanza); m_parent = (Element)d.ParentNode; m_parent.RemoveChild(d); }
private void m_node_OnItemRemove(PubSubNode node, Jabber.Protocol.IQ.PubSubItem item) { int index = lbID.Items.IndexOf(item.ID); if (lbID.SelectedIndex == index) rtItem.Clear(); if (index >= 0) lbID.Items.RemoveAt(index); }
/// <summary> /// Create an x:data form from the given message stanza. /// </summary> /// <param name="parent">Original stanza</param> public XDataForm(Jabber.Protocol.Client.Message parent) : this(FindData(parent) as Jabber.Protocol.X.Data) { m_stanza = (Packet)parent.CloneNode(true); Data d = FindData(m_stanza); Debug.Assert(d != null); m_parent = (Element)d.ParentNode; m_parent.RemoveChild(d); }
/// <summary> /// Create an x:data form from the given XML form description /// </summary> /// <param name="x">x:data form to render</param> public XDataForm(Jabber.Protocol.X.Data x) : this() { if (x == null) throw new ArgumentException("x:data form must not be null", "x"); m_type = x.Type; this.SuspendLayout(); if (x.Title != null) this.Text = x.Title; if (m_type == XDataType.cancel) { lblInstructions.Text = "Form canceled."; // TODO: Localize! lblInstructions.Resize += new EventHandler(lblInstructions_Resize); lblInstructions_Resize(lblInstructions, null); } else if (x.Instructions == null) lblInstructions.Visible = false; else { lblInstructions.Text = DeWhitespace(x.Instructions); lblInstructions.Resize += new EventHandler(lblInstructions_Resize); lblInstructions_Resize(lblInstructions, null); } pnlFields.SuspendLayout(); Field[] fields = x.GetFields(); m_fields = new FormField[fields.Length]; for (int i = fields.Length - 1; i >= 0; i--) { m_fields[i] = new FormField(fields[i], this, i); } panel1.TabIndex = fields.Length; if (m_type != XDataType.form) { btnOK.Location = btnCancel.Location; btnCancel.Visible = false; } pnlFields.ResumeLayout(true); this.ResumeLayout(true); for (int i = 0; i < fields.Length; i++) { if ((fields[i].Type != FieldType.hidden) && (fields[i].Type != FieldType.Fixed)) m_fields[i].Focus(); } }
/// <summary> /// Writes a stream:stream start tag. /// </summary> /// <param name="stream">Stream containing the stream:stream packet to send.</param> public override void WriteStartTag(Jabber.Protocol.Stream.Stream stream) { Write(stream.StartTag()); }
public SendMessage(Jabber.Client.JabberClient jc) { InitializeComponent(); m_jc = jc; }
private void GotItems(DiscoManager sender, Jabber.Connection.DiscoNode node, object state) { // TODO: some of this will break in 2003. TreeNode[] nodes = tvServices.Nodes.Find(node.Key, true); foreach (TreeNode n in nodes) { n.ImageIndex = 7; n.SelectedImageIndex = 7; foreach (Jabber.Connection.DiscoNode dn in node.Children) { TreeNode tn = n.Nodes.Add(dn.Key, dn.Name); tn.ToolTipText = dn.Key.Replace('\u0000', '\n'); tn.Tag = dn; tn.ImageIndex = 8; tn.SelectedImageIndex = 8; } } pgServices.Refresh(); }
/// <summary> /// Log in to the server /// </summary> /// <param name="cli">The JabberClient instance to connect</param> /// <param name="propertyFile">The name of an XML file to store properties in.</param> /// <returns>True if the user clicked OK, false on cancel</returns> public static bool Login(Jabber.Client.JabberClient cli, string propertyFile) { return new ClientLogin(cli).Login(propertyFile); }
private void JabberClient_OnSASLEnd(Object sender, Jabber.Protocol.Stream.Features feat) { lock (StateLock) { State = BindState.Instance; } if (feat["bind", URI.BIND] != null) { IQ iq = new IQ(this.Document); iq.Type = IQType.set; Jabber.Protocol.Stream.Bind bind = new Jabber.Protocol.Stream.Bind(this.Document); if ((Resource != null) && (Resource != "")) bind.Resource = Resource; iq.AddChild(bind); this.Tracker.BeginIQ(iq, new IqCB(GotResource), feat); } else if (feat["session", URI.SESSION] != null) { IQ iq = new IQ(this.Document); iq.Type = IQType.set; iq.AddChild(new Jabber.Protocol.Stream.Session(this.Document)); this.Tracker.BeginIQ(iq, new IqCB(GotSession), feat); } else IsAuthenticated = true; }
/// <summary> /// Creates the node using the specified configuration form. /// </summary> /// <param name="config">Null for the default configuration</param> public void Create(Jabber.Protocol.X.Data config) { lock (this) { if (!NeedsAsking(this[Op.CREATE])) { SubscribeIfPending(); return; } this[Op.CREATE] = STATE.Asking; } /* <iq type='set' from='[email protected]/elsinore' to='pubsub.shakespeare.lit' id='create1'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <create node='princely_musings'/> <configure/> </pubsub> </iq> */ PubSubCommandIQ<Create> iq = new PubSubCommandIQ<Create>(m_stream.Document, m_node); iq.To = m_jid; iq.Type = IQType.set; iq.Command.CreateConfiguration(config); BeginIQ(iq, GotCreated, null); }
private void jc_OnMessage(object sender, Jabber.Protocol.Client.Message msg) { Jabber.Protocol.X.Data x = msg["x", URI.XDATA] as Jabber.Protocol.X.Data; if (x != null) { Muzzle.Forms.XDataForm f = new Muzzle.Forms.XDataForm(msg); f.ShowDialog(this); jc.Write(f.GetResponse()); } else MessageBox.Show(this, msg.Body, msg.From, MessageBoxButtons.OK); }
private void bmm_OnConferenceRemove(Jabber.Client.BookmarkManager manager, BookmarkConference conference) { string jid = conference.JID; if (lvBookmarks.Items.ContainsKey(jid)) lvBookmarks.Items.RemoveByKey(jid); }
private void bmm_OnConferenceAdd(Jabber.Client.BookmarkManager manager, BookmarkConference conference) { string jid = conference.JID; string name = conference.ConferenceName; if (name == null) name = jid; if (lvBookmarks.Items.ContainsKey(jid)) lvBookmarks.Items.RemoveByKey(jid); ListViewItem item = lvBookmarks.Items.Add(jid, name, -1); item.SubItems.Add(conference.Nick); item.SubItems.Add(conference.AutoJoin.ToString()); item.Tag = conference.JID; }
private void muc_OnInvite(object sender, Jabber.Protocol.Client.Message msg) { Room r = sender as Room; r.Join(); }
private void rm_OnUnsubscription(Jabber.Client.RosterManager manager, Presence pres, ref bool remove) { MessageBox.Show(pres.From + " has removed you from their roster.", "Unsubscription notification", MessageBoxButtons.OK); }
private void rm_OnSubscription(Jabber.Client.RosterManager manager, Item ri, Presence pres) { DialogResult res = MessageBox.Show("Allow incoming presence subscription request from: " + pres.From, "Subscription Request", MessageBoxButtons.YesNoCancel); switch (res) { case DialogResult.Yes: manager.ReplyAllow(pres); break; case DialogResult.No: manager.ReplyDeny(pres); break; case DialogResult.Cancel: // do nothing; break; } }
public override void ProcessEvent(Jabber.Util.Event ev) { if (!IsTopScreen) { return; } if (ev is ExplosionEvent) { ExplosionPlayed = true; } if (!ExplosionPlayed) { /* if (ev is BreakableDestroyed && !(ev is BreakableHit)) { if (!SFXPlayed((ev as BreakableDestroyed).Broken)) { // if (SFXTime((ev as BreakableDestroyed).Broken) <= 0) { BreakableBody.PlaySFXBreakForMaterial((ev as BreakableDestroyed).Broken); SFXPlayed((ev as BreakableDestroyed).Broken, true); } } else { int k = 0; } } else if (ev is BreakableHit) { if (!SFXPlayed((ev as BreakableHit).Broken)) { if (SFXTime((ev as BreakableHit).Broken) <= 0.0f) { BreakableBody.PlayHitSFXForMaterial((ev as BreakableHit).Broken); SFXPlayed((ev as BreakableHit).Broken, true); } } }*/ } if (ev is CannonFireEvent && scene.ToFire.Count > 0) { CannonFireEvent e = ev as CannonFireEvent; Vector2 dir = e.Dir; Chicken chick = null;// new Chicken_Dash(world); switch (scene.ToFire[scene.ToFire.Count - 1]) { case 0: chick = new Chicken(scene); break; case 1: chick = new Chicken_Dash(scene); break; case 2: chick = new Chicken_Egg(scene); break; case 3: chick = new Chicken_Explode(scene); break; case 4: chick = new Chicken_Mini_Launcher(scene); break; } chick.Initialize(Content); chick.Position = e.Position; chick.Body.LinearVelocity = dir; withChicks.AddNode(chick); bForceInactiveChicken = false; bFollowingChicken = true; scene.ToFire.RemoveAt(scene.ToFire.Count - 1); } else if (ev is MenuEvent && IsTopScreen) { if ((ev as MenuEvent).sender is MenuObj) { if (((ev as MenuEvent).sender as MenuObj).Name == "pause") { PauseScreen s = new PauseScreen(); s.Initialize(Content); ScreenManager.Get.AddScreen(s); } else if (((ev as MenuEvent).sender as MenuObj).Name == "restart") { Restart(); AudioManager.PlayOnce("Sounds/Restart"); } else if (((ev as MenuEvent).sender as MenuObj).Name == "forceendgame") { //if (!AnyFox) { for (int i = 0; i < scene.Nodes.Count; i++) { if (scene.Nodes[i] is DonutCase) { scene.Nodes[i].RaiseFlag(Flags.DELETE); scene.Nodes[i].UnloadContent(); scene.Nodes.RemoveAt(i); --i; } else if(scene.Nodes[i] is Donut) { scene.Nodes[i].RaiseFlag(Flags.DELETE); scene.Nodes[i].UnloadContent(); scene.Nodes.RemoveAt(i); --i; } } //HasWon = true; LevelEndScreen n = new LevelEndScreen(this); n.Initialize(Content); ScreenManager.Get.AddScreen(n); LowerFlag(Jabber.Flags.FADE_OUT); LowerFlag(Jabber.Flags.FADE_IN); if (GetRemainingFox() == 0) AudioManager.PlayOnce("Sounds/Win_Stinger"); else AudioManager.PlayOnce("Sounds/Lose_Stinger"); } } } } base.ProcessEvent(ev); }
private void m_roster_OnRosterItem(object sender, Jabber.Protocol.IQ.Item ri) { this.ProcessRosterItem(ri); }
private void GotInfo(DiscoManager sender, Jabber.Connection.DiscoNode node, object state) { pgServices.SelectedObject = node; }
private void m_stream_OnConnect(object sender, Jabber.Connection.StanzaStream stream) { this.InvokeOrNot(() => { this.NbLines = 0; this.rtDebug.Clear(); }); }
/// <summary> /// Writes a stream:stream start tag. /// Some underlying implementations will ignore this, /// but may pull out pertinent data. /// </summary> /// <param name="stream">Stream containing the start tag.</param> abstract public void WriteStartTag(Jabber.Protocol.Stream.Stream stream);
private void JabberService_OnSASLStart(object sender, Jabber.Connection.SASL.SASLProcessor proc) { Jabber.Connection.BaseState s = null; lock (StateLock) { s = State; } if (s == Jabber.Connection.NonSASLAuthState.Instance) { lock (StateLock) { State = HandshakingState.Instance; } if (this.Type == ComponentType.Accept) { Handshake hand = new Handshake(this.Document); hand.SetAuth(this.Secret, StreamID); Write(hand); } } }
/// <summary> /// Create a Client Login dialog box that manages a component /// </summary> /// <param name="service">The component to manage</param> public ComponentLogin(Jabber.Server.JabberService service) : this() { this.Xmpp = service; }
private void JabberClient_OnSASLStart(Object sender, Jabber.Connection.SASL.SASLProcessor proc) { BaseState s = null; lock (StateLock) { s = State; } // HACK: fire OnSASLStart with state of NonSASLAuthState to initiate old-style auth. if (s == NonSASLAuthState.Instance) { if ((bool)this[Options.AUTO_LOGIN_THISPASS]) Login(); else LoginRequired(ManualLoginState.Instance); } else { if ((bool)this[Options.AUTO_LOGIN_THISPASS]) { // TODO: integrate SASL params into XmppStream params proc[SASLProcessor.USERNAME] = User; proc[SASLProcessor.PASSWORD] = Password; proc[MD5Processor.REALM] = this.Server; object creds = this[KerbProcessor.USE_WINDOWS_CREDS]; if (creds == null) creds = false; proc[KerbProcessor.USE_WINDOWS_CREDS] = creds.ToString(); } else { LoginRequired(ManualSASLLoginState.Instance); } } }
/// <summary> /// Log in to the server /// </summary> /// <param name="service">The JabberClient instance to connect</param> /// <param name="propertyFile">The name of an XML file to store properties in.</param> /// <returns>True if the user clicked OK, false on cancel</returns> public static bool Login(Jabber.Server.JabberService service, string propertyFile) { return new ComponentLogin(service).Login(propertyFile); }
/// <summary> /// Create a Client Login dialog box than manages the connection properties of a particular client /// connection. /// </summary> /// <param name="cli">The client connection to modify</param> public ClientLogin(Jabber.Client.JabberClient cli) : this() { this.Xmpp = cli; }
public SendMessage(Jabber.Client.JabberClient jc, string toJid) : this(jc) { txtTo.Text = toJid; }
/// <summary> /// Writes just the start tag of the given XML element. /// Typically only used for <stream:stream>. /// </summary> /// <param name="elem"><stream:stream%gt; XML element.</param> public void WriteStartTag(Jabber.Protocol.Stream.Stream elem) { m_stanzas.WriteStartTag(elem); }
private void GotInitialFeatures(DiscoManager sender, Jabber.Connection.DiscoNode node, object state) { m_disco.BeginGetItems(node, new Jabber.Connection.DiscoNodeHandler(GotItems), state); }