Esempio n. 1
0
        internal MSNAuthentication(MSNController controller, String username, String password)
        {
            this.username = username;
            this.password = password;

            this.controller = controller;
        }
        internal MSNSwitchboardController(MSNController controller)
        {
            this.controller = controller;

            incommingMessageThread      = new Thread(new ThreadStart(processMessageLoop));
            incommingMessageThread.Name = "MSNSwitchboard incomming message processor thread";
            incommingMessageThread.Start();
        }
Esempio n. 3
0
        private MSNEnumerations.NewContact handleNewContact = MSNEnumerations.NewContact.manual_add; //how to handle a new contact (auto add to allow list or not)
        #endregion

        #region constructor / dispose
        internal MSNContactsList(MSNController controller)
        {
            this.controller = controller;
            controller.LoginStatusChanged += new MSNEventDelegates.LoginStatusChangedEventDelegate(controller_LoginStatusChanged);

            processingQueueThread      = new Thread(new ThreadStart(processMessageLoop));
            processingQueueThread.Name = "Contacts List Message Processing Thread";
            processingQueueThread.Start();
        }
Esempio n. 4
0
        internal MSNSwitchboard(MSNController controller, String addressString, int addressPort, String authenticateString, String rngTrID) //handles conversations started by local client
        {
            try
            {
                this.controller = controller;

                #region connect to switchboard
                try
                {
                    switchboardSocket = new MSNSocketWrapper(addressString, addressPort, false);

                    if (!switchboardSocket.connected())
                    {
                        Console.WriteLine("Error making switchboard connection in MSNSwitchboard(" + controller.ToString() + ", " + addressString + ", " + addressPort + ", " + authenticateString + ")");
                        throw new Exception("Could not connect to switchboard in MSNSwitchboard(" + controller.ToString() + ", " + addressString + ", " + addressPort + ", " + authenticateString + ")");
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("Error making switchboard connection in MSNSwitchboard(" + controller.ToString() + ", " + addressString + ", " + addressPort + ", " + authenticateString + ")");
                    return;
                }
                #endregion

                #region authenticate
                //ANS 1 [email protected] 1056411141.26158 17342299\r\n
                switchboardSocket.send(new MSNMessage("ANS " + MSNTrIDGenerator.NextID() + " " + controller.Username + " " + authenticateString + " " + rngTrID + "\r\n"));
                #endregion

                #region incommingMessageReadThread
                incommingMessageHandlerThread      = new Thread(new ThreadStart(processIncommingMessageLoop));
                incommingMessageHandlerThread.Name = "MSNSwitchboard incomming read thread";
                incommingMessageHandlerThread.Start();
                #endregion

                #region incommingMSGThread
                incommingMSGThread      = new Thread(new ThreadStart(incommingMSGLoop));
                incommingMSGThread.Name = "Incomming MSG handler thread";
                incommingMSGThread.Start();
                #endregion

                #region outgoingMSGThread
                outgoingMSGThread      = new Thread(new ThreadStart(outgoingMSGLoop));
                outgoingMSGThread.Name = "Outgoing MSG handler thread";
                outgoingMSGThread.Start();
                #endregion

                plugins.ElementAdded += new MSNListenableList <IMSNSwitchboardPlugin> .ElementAddedDelegate(plugins_ElementAdded);
            }
            catch (Exception)
            {
                Console.WriteLine("Error establishing switchboard session in MSNSwitchboard(" + controller.ToString() + ", " + addressString + ", " + addressPort + ", " + authenticateString + ")");
            }
        }
Esempio n. 5
0
        public MSNGroup(MSNController controller, String name, int groupNumber)
        {
            this.controller  = controller;
            this.name        = name;
            this.groupNumber = groupNumber;

            controller.sendAddRemoveGroupMessage(name, true);

            contacts.ElementAdded += new MSNListenableList <MSNContact> .ElementAddedDelegate(contacts_ElementAdded);

            contacts.ElementRemoved += new MSNListenableList <MSNContact> .ElementRemovedDelegate(contacts_ElementRemoved);
        }
Esempio n. 6
0
        public void InitMSN()
        {
            m_msn = new DNBSoft.MSN.ClientController.MSNController();

            m_msn.LoginStatusChanged += new dotMSN.MSNEventDelegates.LoginStatusChangedEventDelegate(OnSignedIn);
            m_msn.SwitchboardController.SwitchboardCreated += new dotMSN.MSNEventDelegates.SwitchboardCreated(SwitchboardController_SwitchboardCreated);
            m_msn.ContactStatusChanged += new DNBSoft.MSN.ClientController.MSNEventDelegates.ContactStatusChangedEventDelegate(m_msn_ContactStatusChanged);

            //m_msn = new DotMSN.Messenger();

            //m_msn.Credentials.ClientID = "*****@*****.**";
            //m_msn.Credentials.ClientCode = "Q1P7W2E4J9R8U3S5";

            //m_msn.Nameserver.SignedIn += new EventHandler(OnSignedIn);
            //m_msn.Nameserver.SignedOff += new DotMSN.SignedOffEventHandler(OnConnectionFailure);
            //m_msn.ConversationCreated += new DotMSN.ConversationCreatedEventHandler(OnConversationCreated);

            //m_msn.ConversationCreated += new Messenger.ConversationCreatedHandler(ConversationCreated);
            //m_msn.ContactOffline += new DotMSN.Messenger.ContactOfflineHandler(UserSignedOff);
            //m_msn.ContactOnline += new DotMSN.Messenger.ContactOnlineHandler(UserSignedOn);

            m_type = ConnectionType.MSN;
        }
Esempio n. 7
0
        internal MSNLocalClient(MSNController controller)
        {
            this.controller = controller;

            controller.LoginStatusChanged += new MSNEventDelegates.LoginStatusChangedEventDelegate(controller_LoginStatusChanged);
        }
Esempio n. 8
0
        internal MSNSwitchboard(MSNController controller, String addressString, int addressPort, String authenticateString, List <String> initialUsers) //handles conversations started by local client
        {
            try
            {
                this.controller = controller;

                #region connect to switchboard
                try
                {
                    switchboardSocket = new MSNSocketWrapper(addressString, addressPort, false);

                    if (!switchboardSocket.connected())
                    {
                        Console.WriteLine("Error making switchboard connection in MSNSwitchboard(" + controller.ToString() + ", " + addressString + ", " + addressPort + ", " + authenticateString + ", " + initialUsers.ToString() + ")");
                        throw new Exception("Could not connect to switchboard in MSNSwitchboard(" + controller.ToString() + ", " + addressString + ", " + addressPort + ", " + authenticateString + ", " + initialUsers.ToString() + ")");
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("Error making switchboard connection in MSNSwitchboard(" + controller.ToString() + ", " + addressString + ", " + addressPort + ", " + authenticateString + ", " + initialUsers.ToString() + ")");
                    return;
                }
                #endregion

                #region authenticate
                //USR 7 [email protected] 189597.1056411784.29994\r\n
                switchboardSocket.send(new MSNMessage("USR " + MSNTrIDGenerator.NextID() + " " + controller.Username + " " + authenticateString + "\r\n"));
                #endregion

                #region add initial users
                //CAL 8 [email protected]\r\n
                if (initialUsers != null)
                {
                    for (int i = 0; i < initialUsers.Count; i++)
                    {
                        switchboardSocket.send(new MSNMessage("CAL " + MSNTrIDGenerator.NextID() + " " + initialUsers[i] + "\r\n"));
                    }
                }
                #endregion

                #region incommingMessageReadThread
                incommingMessageHandlerThread      = new Thread(new ThreadStart(processIncommingMessageLoop));
                incommingMessageHandlerThread.Name = "MSNSwitchboard incomming read thread";
                incommingMessageHandlerThread.Start();
                #endregion

                #region incommingMSGThread
                incommingMSGThread      = new Thread(new ThreadStart(incommingMSGLoop));
                incommingMSGThread.Name = "Incomming MSG handler thread";
                incommingMSGThread.Start();
                #endregion

                #region outgoingMSGThread
                outgoingMSGThread      = new Thread(new ThreadStart(outgoingMSGLoop));
                outgoingMSGThread.Name = "Outgoing MSG handler thread";
                outgoingMSGThread.Start();
                #endregion

                plugins.ElementAdded += new MSNListenableList <IMSNSwitchboardPlugin> .ElementAddedDelegate(plugins_ElementAdded);
            }
            catch (Exception)
            {
                //Console.WriteLine("Error establishing switchboard session in MSNSwitchboard(" + controller.ToString() + ", " + addressString + ", " + addressPort + ", " + authenticateString + ", " + initialUsers.ToString() + ")");
            }
        }
Esempio n. 9
0
 public MSNContact(MSNController controller, String username)
 {
     this.controller = controller;
     this.username   = username;
 }