Exemplo n.º 1
0
        private void OnStanza(agsXMPP.protocol.Base.Stanza stanza)
        {
            var item = listView1.Items.Add(stanza.ToString());

            item.SubItems.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            item.SubItems.Add(stanza.TagName.ToUpper());
            item.EnsureVisible();
            item.Tag = stanza;
        }
Exemplo n.º 2
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count != 1)
            {
                return;
            }

            agsXMPP.protocol.Base.Stanza stanza =
                (agsXMPP.protocol.Base.Stanza)listView1.SelectedItems[0].Tag;

            listBox1.SelectedIndex = -1;
            setEditorText(stanza.ToString(System.Xml.Formatting.Indented, 2));
        }
Exemplo n.º 3
0
        public XmppHandlerResult ProcessElement(agsXMPP.protocol.Base.Stanza element, XmppSession session, XmppHandlerContext context)
        {
            if (!element.HasTo)
            {
                return(Error(session, agsXMPP.protocol.client.ErrorCondition.BadRequest, element));
            }

            if (element.To.Server == domain.Server)
            {
                var to = context.Sessions.GetSession(domain);
                return(to != null?Send(to, element) : Error(session, agsXMPP.protocol.client.ErrorCondition.ServiceUnavailable, element));
            }

            return(Send(context.Sessions.GetSessions(element.To), element));
        }