public ServiceDiscvoryManager(XmppClientConnection client, Action<Jid> callback)
        {
            this.callback = callback;
            discoManager = new DiscoManager(client);

            search = new Queue<Jid>();
            search.Enqueue(new Jid(client.Server));
        }
Exemple #2
0
        public frmMain()
        {
            InitializeComponent();
            treeGC.ContextMenuStrip = contextMenuGC;
            contactListPanel.BringToFront();

            // initialize Combo Status
            cboStatus.Items.AddRange(new object[] {"offline",
                                                    ShowType.away.ToString(),
                                                    ShowType.xa.ToString(),
                                                    ShowType.chat.ToString(),
                                                    ShowType.dnd.ToString(),
                                                    "online" });
            cboStatus.SelectedIndex = 0;

            // initilaize XmppConnection
            XmppCon = new XmppClientConnection();

            XmppCon.SocketConnectionType = agsXMPP.net.SocketConnectionType.Direct;

            XmppCon.OnReadXml += new XmlHandler(XmppCon_OnReadXml);
            XmppCon.OnWriteXml += new XmlHandler(XmppCon_OnWriteXml);

            XmppCon.OnRosterStart += new ObjectHandler(XmppCon_OnRosterStart);
            XmppCon.OnRosterEnd += new ObjectHandler(XmppCon_OnRosterEnd);
            XmppCon.OnRosterItem += new agsXMPP.XmppClientConnection.RosterHandler(XmppCon_OnRosterItem);

            XmppCon.OnAgentStart += new ObjectHandler(XmppCon_OnAgentStart);
            XmppCon.OnAgentEnd += new ObjectHandler(XmppCon_OnAgentEnd);
            XmppCon.OnAgentItem += new agsXMPP.XmppClientConnection.AgentHandler(XmppCon_OnAgentItem);

            XmppCon.OnLogin += new ObjectHandler(XmppCon_OnLogin);
            XmppCon.OnClose += new ObjectHandler(XmppCon_OnClose);
            XmppCon.OnError += new ErrorHandler(XmppCon_OnError);
            XmppCon.OnPresence += new PresenceHandler(XmppCon_OnPresence);
            XmppCon.OnMessage += new MessageHandler(XmppCon_OnMessage);
            XmppCon.OnIq += new IqHandler(XmppCon_OnIq);
            XmppCon.OnAuthError += new XmppElementHandler(XmppCon_OnAuthError);
            XmppCon.OnSocketError += new ErrorHandler(XmppCon_OnSocketError);
            XmppCon.OnStreamError += new XmppElementHandler(XmppCon_OnStreamError);

            XmppCon.OnReadSocketData += new agsXMPP.net.BaseSocket.OnSocketDataHandler(ClientSocket_OnReceive);
            XmppCon.OnWriteSocketData += new agsXMPP.net.BaseSocket.OnSocketDataHandler(ClientSocket_OnSend);

            XmppCon.ClientSocket.OnValidateCertificate += new System.Net.Security.RemoteCertificateValidationCallback(ClientSocket_OnValidateCertificate);

            XmppCon.OnXmppConnectionStateChanged += new XmppConnectionStateHandler(XmppCon_OnXmppConnectionStateChanged);
            XmppCon.OnSaslStart += new SaslEventHandler(XmppCon_OnSaslStart);

            discoManager = new DiscoManager(XmppCon);

            agsXMPP.Factory.ElementFactory.AddElementType("Login", null, typeof(Settings.Login));
            LoadChatServers();

            frmLogin f = new frmLogin(XmppCon);

            if (f.ShowDialog() == DialogResult.OK)
            {
                XmppCon.Open();
            }
        }
Exemple #3
0
        private void SetDiscoInfo()
        {
            _connection.Capabilities = new Capabilities
            {
                Node = ExtUri.APP
            };

            var discoManager = new DiscoManager(_connection);
            _connection.DiscoInfo.AddIdentity(new DiscoIdentity("pc", "vstalk", "client"));

            _connection.DiscoInfo.AddFeature(new DiscoFeature(agsXMPP.Uri.CAPS));
            _connection.DiscoInfo.AddFeature(new DiscoFeature(agsXMPP.Uri.CHATSTATES));
            _connection.DiscoInfo.AddFeature(new DiscoFeature(agsXMPP.Uri.DISCO_INFO));
            _connection.DiscoInfo.AddFeature(new DiscoFeature(agsXMPP.Uri.DISCO_ITEMS));
            _connection.DiscoInfo.AddFeature(new DiscoFeature(agsXMPP.Uri.MUC));
            _connection.DiscoInfo.AddFeature(new DiscoFeature(agsXMPP.Uri.IQ_VERSION));
            _connection.DiscoInfo.AddFeature(new DiscoFeature(agsXMPP.Uri.PING));

            _connection.DiscoInfo.AddFeature(new DiscoFeature(ExtUri.XAML));
            _connection.UpdateCapsVersion();

            _connection.DiscoInfo.Node = string.Format("{0}#{1}", _connection.Capabilities.Node, _connection.Capabilities.Version);

            discoManager.AutoAnswerDiscoInfoRequests = true;
        }
Exemple #4
0
 private void xmppDiscoServer()
 {
     DiscoManager dm = new DiscoManager(xmpp);
     dm.AutoAnswerDiscoInfoRequests = false;
     dm.DiscoverInformation(new Jid(xmpp.Server), new IqCB(xmppDiscoServerInformation), new Jid(xmpp.Server));
 }
 static void HipchatClient_OnLogin(object sender)
 {
     HipchatClient.OnIq += (e, mIq) =>
     {
         if (mIq.Type == IqType.error) return;
         DiscoItems item = mIq.Query as DiscoItems;
         if (item == null) return;
         var items = item.GetDiscoItems();
         foreach (HipchatRoom hipChatRoom in items.Select(room => new HipchatRoom(room.Name, room.Jid)))
         {
             Rooms.Add(hipChatRoom);
             Lobby.DoRoomCheck();
         }
     };
     DiscoManager mgnr = new DiscoManager(HipchatClient);
     mgnr.DiscoverItems(new Jid("conf.hipchat.com"));
 }
Exemple #6
0
        public XmppProtocolManager(Session session)
            : base(session)
        {
            Trace.Call(session);
            Contacts = new Dictionary<Jid, XmppPersonModel>();
            DiscoCache = new Dictionary<string, DiscoInfo>();

            ShowChatStates = true;
            OpenNewChatOnChatState = true;

            JabberClient = new XmppClientConnection();
            JabberClient.AutoRoster = true;
            JabberClient.AutoPresence = true;
            JabberClient.OnMessage += OnMessage;
            JabberClient.OnClose += OnClose;
            JabberClient.OnLogin += OnLogin;
            JabberClient.OnError += OnError;
            JabberClient.OnStreamError += OnStreamError;
            JabberClient.OnPresence += OnPresence;
            JabberClient.OnRosterItem += OnRosterItem;
            JabberClient.OnReadXml += OnReadXml;
            JabberClient.OnWriteXml += OnWriteXml;
            JabberClient.OnAuthError += OnAuthError;
            JabberClient.SendingServiceUnavailable += OnSendingServiceUnavailable;
            JabberClient.AutoAgents = false; // outdated feature
            JabberClient.EnableCapabilities = true;
            JabberClient.Capabilities.Node = "https://smuxi.im";
            JabberClient.ClientVersion = Engine.VersionString;

            // identify smuxi
            var ident = JabberClient.DiscoInfo.AddIdentity();
            ident.Category = "client";
            ident.Type = "pc";
            ident.Name = Engine.VersionString;

            // add features here (this is just for notification of other clients)
            JabberClient.DiscoInfo.AddFeature().Var = "http://jabber.org/protocol/caps";
            JabberClient.DiscoInfo.AddFeature().Var = "jabber:iq:last";
            JabberClient.DiscoInfo.AddFeature().Var = "http://jabber.org/protocol/muc";
            JabberClient.DiscoInfo.AddFeature().Var = "http://jabber.org/protocol/disco#info";
            JabberClient.DiscoInfo.AddFeature().Var = "http://jabber.org/protocol/xhtml-im";

            Disco = new DiscoManager(JabberClient);
            Disco.AutoAnswerDiscoInfoRequests = true;

            MucManager = new MucManager(JabberClient);
        }
Exemple #7
0
        /// <summary>
        /// Callback
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="iq"></param>
        /// <param name="data"></param>
        private void OnDiscoServerResult(object sender, IQ iq, object data)
        {
            if (iq.Type == IqType.result)
            {
                Element query = iq.Query;
                if (query != null && query.GetType() == typeof(DiscoItems))
                {
                    DiscoItems items = query as DiscoItems;
                    DiscoItem[] itms = items.GetDiscoItems();
                    
                    DiscoManager dm = new DiscoManager(XmppCon);

                    foreach (DiscoItem itm in itms)
                    {
                        if (itm.Jid != null)
                            dm.DiscoverInformation(itm.Jid, new IqCB(OnDiscoInfoResult), itm);
                    }
                }
            }
        }
Exemple #8
0
 // Sending Disco request to the server we are connected to for discovering
 // the services runing on our server
 private void DiscoServer()
 {             
     DiscoManager dm = new DiscoManager(XmppCon);
     dm.DiscoverItems(new Jid(XmppCon.Server), new IqCB(OnDiscoServerResult), null);            
 }
Exemple #9
0
        public frmMain()
        {
            InitializeComponent();

            treeGC.ContextMenuStrip = contextMenuGC;

            // initialize Combo Status
            cboStatus.Items.AddRange( new object[] {"offline",
                                                    ShowType.away.ToString(),
                                                    ShowType.xa.ToString(),
                                                    ShowType.chat.ToString(),
                                                    ShowType.dnd.ToString(),
                                                    "online" });
            cboStatus.SelectedIndex = 0;

            // initilaize XmppConnection
            XmppCon = new XmppClientConnection();

            XmppCon.SocketConnectionType = agsXMPP.net.SocketConnectionType.Direct;

            XmppCon.OnReadXml		    += new XmlHandler(XmppCon_OnReadXml);
            XmppCon.OnWriteXml		    += new XmlHandler(XmppCon_OnWriteXml);

            XmppCon.OnRosterStart	    += new ObjectHandler(XmppCon_OnRosterStart);
            XmppCon.OnRosterEnd		    += new ObjectHandler(XmppCon_OnRosterEnd);
            XmppCon.OnRosterItem	    += new agsXMPP.XmppClientConnection.RosterHandler(XmppCon_OnRosterItem);

            XmppCon.OnAgentStart	    += new ObjectHandler(XmppCon_OnAgentStart);
            XmppCon.OnAgentEnd		    += new ObjectHandler(XmppCon_OnAgentEnd);
            XmppCon.OnAgentItem		    += new agsXMPP.XmppClientConnection.AgentHandler(XmppCon_OnAgentItem);

            XmppCon.OnLogin			    += new ObjectHandler(XmppCon_OnLogin);
            XmppCon.OnClose			    += new ObjectHandler(XmppCon_OnClose);
            XmppCon.OnError			    += new ErrorHandler(XmppCon_OnError);
            XmppCon.OnPresence		    += new PresenceHandler(XmppCon_OnPresence);
            XmppCon.OnMessage		    += new MessageHandler(XmppCon_OnMessage);
            XmppCon.OnIq			    += new IqHandler(XmppCon_OnIq);
            XmppCon.OnAuthError		    += new XmppElementHandler(XmppCon_OnAuthError);
            XmppCon.OnSocketError += new ErrorHandler(XmppCon_OnSocketError);
            XmppCon.OnStreamError += new XmppElementHandler(XmppCon_OnStreamError);

            XmppCon.OnReadSocketData    += new agsXMPP.net.BaseSocket.OnSocketDataHandler(ClientSocket_OnReceive);
            XmppCon.OnWriteSocketData   += new agsXMPP.net.BaseSocket.OnSocketDataHandler(ClientSocket_OnSend);

            XmppCon.ClientSocket.OnValidateCertificate += new System.Net.Security.RemoteCertificateValidationCallback(ClientSocket_OnValidateCertificate);

            XmppCon.OnXmppConnectionStateChanged		+= new XmppConnectionStateHandler(XmppCon_OnXmppConnectionStateChanged);
            XmppCon.OnSaslStart                         += new SaslEventHandler(XmppCon_OnSaslStart);

            discoManager = new DiscoManager(XmppCon);

            agsXMPP.Factory.ElementFactory.AddElementType("Login", null, typeof(Settings.Login));
            LoadChatServers();
            MiniClient.Label l = new Label();
            l.Id = "Rango";
            l.MemberLst.Add("*****@*****.**");
            l.MemberLst.Add("*****@*****.**");
            MiniClient.Label.LabelLst.Add(l);
            LoadLabels();
        }