Beispiel #1
0
 /// <summary>
 /// Adds these identities to the node.
 /// </summary>
 /// <param name="id">Identities to add.</param>
 public void AddIdentity(Ident id)
 {
     if (Identity == null)
     {
         Identity = new Set();
     }
     Identity.Add(id);
 }
Beispiel #2
0
        /// <summary>
        /// Compare to another identity, by comparing the string-ified versions
        /// of each.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int CompareTo(object obj)
        {
            if ((object)this == obj)
            {
                return(0);
            }
            Ident other = obj as Ident;

            if (other == null)
            {
                return(1);
            }
            return(Key.CompareTo(other.Key));
        }
Beispiel #3
0
        /// <summary>
        /// Retrieves an identity object for each identity of the node.
        /// </summary>
        /// <returns>List of identities associated with this node.</returns>
        public Ident[] GetIdentities()
        {
            if (Identity == null)
            {
                return(new Ident[0]);
            }

            Ident[] ret   = new Ident[Identity.Count];
            int     count = 0;

            foreach (Ident i in Identity)
            {
                ret[count++] = i;
            }
            return(ret);
        }
Beispiel #4
0
        public MainForm()
        {
            InitializeComponent();

            Jabber.Connection.Ident ident2 = new Jabber.Connection.Ident();
            ident2.Category    = "client";
            ident2.Lang        = "en";
            ident2.Name        = "Jabber-Net Test Client";
            ident2.Type        = "pc";
            this.cm.Identities = new Jabber.Connection.Ident[] { ident2 };

            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;
        }
Beispiel #5
0
        public MainForm()
        {
            InitializeComponent();

            Jabber.Connection.Ident ident2 = new Jabber.Connection.Ident();
            ident2.Category = "client";
            ident2.Lang = "en";
            ident2.Name = "Jabber-Net Test Client";
            ident2.Type = "pc";
            this.cm.Identities = new Jabber.Connection.Ident[] { ident2 };

            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;
        }
 /// <summary>
 /// Adds a new identity
 /// </summary>
 /// <param name="id"></param>
 public void AddIdentity(Ident id)
 {
     m_ver = null;
     m_disco.AddIdentity(id);
 }
Beispiel #7
0
 /// <summary>
 /// Adds a new identity
 /// </summary>
 /// <param name="id"></param>
 public void AddIdentity(Ident id)
 {
     m_ver = null;
     m_disco.AddIdentity(id);
 }
Beispiel #8
0
 /// <summary>
 /// Adds these identities to the node.
 /// </summary>
 /// <param name="id">Identities to add.</param>
 public void AddIdentity(Ident id)
 {
     if (Identity == null)
         Identity = new Set();
     Identity.Add(id);
 }
Beispiel #9
0
        /// <summary>
        /// Retrieves an identity object for each identity of the node.
        /// </summary>
        /// <returns>List of identities associated with this node.</returns>
        public Ident[] GetIdentities()
        {
            if (Identity == null)
                return new Ident[0];

            Ident[] ret = new Ident[Identity.Count];
            int count = 0;
            foreach (Ident i in Identity)
            {
                ret[count++] = i;
            }
            return ret;
        }
Beispiel #10
0
        private void GotAgents(object sender, IQ iq, object onode)
        {
            DiscoNode dn = onode as DiscoNode;
            Debug.Assert(dn != null);

            if (iq.Type != IQType.result)
            {
                dn.AddItems(this, null);
                return;
            }

            AgentsQuery aq = iq.Query as AgentsQuery;
            if (aq == null)
            {
                dn.AddItems(this, null);
                return;
            }

            if (dn.Children == null)
                dn.Children = new Set();

            foreach (Agent agent in aq.GetAgents())
            {
                DiscoItem di = new DiscoItem(m_stream.Document);
                di.Jid = agent.JID;
                di.Named = agent.AgentName;

                DiscoNode child = dn.AddItem(this, di);
                if (child.Features == null)
                    child.Features = new StringSet();
                if (child.Identity == null)
                    child.Identity = new Set();

                Ident id = new Ident();
                id.Name = agent.Description;
                switch (agent.Service)
                {
                case "groupchat":
                    id.Category = "conference";
                    id.Type = "text";
                    child.Identity.Add(id);
                    break;
                case "jud":
                    id.Category = "directory";
                    id.Type = "user";
                    child.Identity.Add(id);
                    break;
                case null:
                case "":
                    break;
                default:
                    // guess this is a transport
                    id.Category = "gateway";
                    id.Type = agent.Service;
                    child.Identity.Add(id);
                    break;
                }

                if (agent.Register)
                    child.Features.Add(URI.REGISTER);
                if (agent.Search)
                    child.Features.Add(URI.SEARCH);
                if (agent.Groupchat)
                    child.Features.Add(URI.MUC);
                if (agent.Transport)
                {
                    if (id.Category != "gateway")
                    {
                        Ident tid = new Ident();
                        tid.Name = id.Name;
                        tid.Category = "gateway";
                        child.Identity.Add(tid);
                    }
                }

                foreach (XmlElement ns in agent.GetElementsByTagName("ns"))
                {
                    child.Features.Add(ns.InnerText);
                }
                child.AddItems(this, null);
                child.AddIdentities(null);
                child.AddFeatures((StringSet)null);
            }
            dn.AddItems(this, null);
            dn.AddIdentities(null);
            dn.AddFeatures((StringSet)null);
        }
Beispiel #11
0
        private void GotAgents(object sender, IQ iq, object onode)
        {
            DiscoNode dn = onode as DiscoNode;

            Debug.Assert(dn != null);

            if (iq.Type != IQType.result)
            {
                dn.AddItems(this, null);
                return;
            }

            AgentsQuery aq = iq.Query as AgentsQuery;

            if (aq == null)
            {
                dn.AddItems(this, null);
                return;
            }

            if (dn.Children == null)
            {
                dn.Children = new Set();
            }

            foreach (Agent agent in aq.GetAgents())
            {
                DiscoItem di = new DiscoItem(m_stream.Document);
                di.Jid   = agent.JID;
                di.Named = agent.AgentName;

                DiscoNode child = dn.AddItem(this, di);
                if (child.Features == null)
                {
                    child.Features = new StringSet();
                }
                if (child.Identity == null)
                {
                    child.Identity = new Set();
                }

                Ident id = new Ident();
                id.Name = agent.Description;
                switch (agent.Service)
                {
                case "groupchat":
                    id.Category = "conference";
                    id.Type     = "text";
                    child.Identity.Add(id);
                    break;

                case "jud":
                    id.Category = "directory";
                    id.Type     = "user";
                    child.Identity.Add(id);
                    break;

                case null:
                case "":
                    break;

                default:
                    // guess this is a transport
                    id.Category = "gateway";
                    id.Type     = agent.Service;
                    child.Identity.Add(id);
                    break;
                }

                if (agent.Register)
                {
                    child.Features.Add(URI.REGISTER);
                }
                if (agent.Search)
                {
                    child.Features.Add(URI.SEARCH);
                }
                if (agent.Groupchat)
                {
                    child.Features.Add(URI.MUC);
                }
                if (agent.Transport)
                {
                    if (id.Category != "gateway")
                    {
                        Ident tid = new Ident();
                        tid.Name     = id.Name;
                        tid.Category = "gateway";
                        child.Identity.Add(tid);
                    }
                }

                foreach (XmlElement ns in agent.GetElementsByTagName("ns"))
                {
                    child.Features.Add(ns.InnerText);
                }
                child.AddItems(this, null);
                child.AddIdentities(null);
                child.AddFeatures((StringSet)null);
            }
            dn.AddItems(this, null);
            dn.AddIdentities(null);
            dn.AddFeatures((StringSet)null);
        }