Ejemplo n.º 1
0
 public MsnThread(IMCommands imCommands)
     : base(_threadName)
 {
     _msnThread        = this;
     _messenger        = new MSNPSharp.Messenger();
     _msnConversations = new MsnConversations(_messenger, imCommands);
 }
Ejemplo n.º 2
0
        public MessengerService(SettingsSection settingsSection)
        {
            if (Log.IsDebugEnabled)
              {
            Log.Debug("Creating MessengerService");
              }

              _messenger = new Messenger
                     {
                       Credentials =
                         {
                           Account = settingsSection.Username,
                           Password = settingsSection.Password
                         }
                     };

              _messenger.ConnectingException += OnMessengerException;
              _messenger.ConnectionEstablished += OnMessengerConnectionEstablished;
              _messenger.ConnectionClosed += OnMessengerConnectionClosed;

              _messenger.Nameserver.ExceptionOccurred += OnMessengerException;
              _messenger.Nameserver.AuthenticationError += OnMessengerException;
              _messenger.Nameserver.ServerErrorReceived += OnNameserverServerErrorReceived;
              _messenger.Nameserver.ContactOnline += OnNameServerContactOnline;
              _messenger.Nameserver.ContactOffline += OnNameServerContactOffline;
              _messenger.Nameserver.SignedIn += OnNameServerSignedIn;
              _messenger.Nameserver.SignedOff += OnNameServerSignedOff;

              _messenger.ContactService.SynchronizationCompleted += OnContactServiceSynchronizationCompleted;

              _messenger.Connect();
        }
Ejemplo n.º 3
0
 public MsnThread(IMCommands imCommands)
     : base(_threadName)
 {
     _msnThread = this;
     _messenger = new MSNPSharp.Messenger();
     _msnConversations = new MsnConversations(_messenger, imCommands);
 }
Ejemplo n.º 4
0
        public MessengerWrapper(string msnUsername, string msnPassword)
        {
            _messenger = new Messenger
             		{
             			Nameserver = {AutoSynchronize = true},
             			Credentials = new Credentials(msnUsername, msnPassword, MsnProtocol.MSNP18),
             		};

            _messenger.NameserverProcessor.ConnectionEstablished += NameserverProcessorConnectionEstablished;
            _messenger.NameserverProcessor.ConnectionClosed += NameserverProcessorConnectionClosed;
            _messenger.Nameserver.Owner.ScreenNameChanged += OwnerScreenNameChanged;
            _messenger.Nameserver.Owner.PersonalMessageChanged += OwnerPersonalMessageChanged;

            _messenger.Nameserver.SignedIn += NameserverSignedIn;
            _messenger.Nameserver.SignedOff += NameserverSignedOff;
            _messenger.Nameserver.ContactOnline += NameserverContactOnline;
            _messenger.Nameserver.ContactOffline += NameserverContactOffline;
            _messenger.Nameserver.ContactStatusChanged += NameserverContactStatusChanged;
            _messenger.ConversationCreated += MessengerConversationCreated;
            _messenger.OIMService.OIMReceived += OimServiceOimReceived;
            _messenger.ContactService.ReverseAdded += ContactServiceReverseAdded;
            _messenger.ContactService.ReverseRemoved += ContactServiceReverseRemoved;

            _messenger.NameserverProcessor.ConnectingException += MessengerException;
            _messenger.NameserverProcessor.HandlerException += MessengerException;
            _messenger.Nameserver.ExceptionOccurred += MessengerException;
            _messenger.Nameserver.AuthenticationError += MessengerException;
            _messenger.Nameserver.ServerErrorReceived += MessengerError;
            _messenger.ContactService.ServiceOperationFailed += OperationFailed;
            _messenger.OIMService.ServiceOperationFailed += OperationFailed;
            _messenger.StorageService.ServiceOperationFailed += OperationFailed;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public MsnNotify()
 {
     // create messenger object
     Messenger = new Messenger();
     Messenger.Nameserver.BotMode = true;
     Messenger.Nameserver.AutoSynchronize = false;
     Messenger.Nameserver.SignedIn += new EventHandler<EventArgs>(SignedIn);
 }
Ejemplo n.º 6
0
        public MsnLoginWindow(Messenger messenger)
        {
            InitializeComponent();

            m_messenger = messenger;

            m_messenger.Nameserver.SignedIn += new EventHandler<EventArgs>(Nameserver_SignedIn);
            m_messenger.Nameserver.AuthenticationError += new EventHandler<ExceptionEventArgs>(Nameserver_AuthenticationError);
        }
Ejemplo n.º 7
0
        public ReverseAddedForm(Contact contact, Messenger messenger)
        {
            InitializeComponent();

            this.pendingContact = contact;
            this.messenger = messenger;

            Text = String.Format(Text, contact.Account);
            lblAdded.Text = String.Format(lblAdded.Text, contact.PublicProfileName + " (" + contact.Account + ")");
        }
Ejemplo n.º 8
0
        /// <summary>
        /// For sending and receiving YIM messages.
        /// </summary>
        /// <param name="messenger"></param>
        /// <param name="contact"></param>
        public ConversationForm(Messenger messenger, Contact contact)
        {
            InitializeComponent();

            _messenger = messenger;
            remoteContact = contact;

            if (contact.ClientType != IMAddressInfoType.WindowsLive)
            {
                btnActivityTest.Enabled = false;
                btnCustomEmoticon.Enabled = false;
                btnSendFiles.Enabled = false;
                btnMultiparty.Enabled = false;
            }
        }
Ejemplo n.º 9
0
        public MsnpProtocolManager(Session session)
            : base(session)
        {
            Trace.Call(session);

            _MsnClient = new Messenger();
            _MsnClient.Credentials.ClientID = "*****@*****.**";
            _MsnClient.Credentials.ClientCode = "Q1P7W2E4J9R8U3S5";

            _MsnClient.NameserverProcessor.ConnectionEstablished += new EventHandler(NameserverProcessor_ConnectionEstablished);
            _MsnClient.NameserverProcessor.ConnectionClosed += new EventHandler(NameserverProcessor_ConnectionClosed);
            _MsnClient.Nameserver.AuthenticationError += new HandlerExceptionEventHandler(_NameServerAuthenticationError);
            _MsnClient.Nameserver.SignedIn += new EventHandler(Nameserver_SignedIn);
            _MsnClient.Nameserver.SignedOff += new SignedOffEventHandler(Nameserver_SignedOff);
            //            _MsnClient.NameserverProcessor.ConnectingException += new ProcessorExceptionEventHandler(NameserverProcessor_ConnectingException);
            //            _MsnClient.Nameserver.ExceptionOccurred += new HandlerExceptionEventHandler(Nameserver_ExceptionOccurred);
            //            _MsnClient.Nameserver.AuthenticationError += new HandlerExceptionEventHandler(Nameserver_AuthenticationError);
            //            _MsnClient.Nameserver.ServerErrorReceived += new ErrorReceivedEventHandler(Nameserver_ServerErrorReceived);
            _MsnClient.ConversationCreated += new ConversationCreatedEventHandler(MsnClient_ConversationCreated);

            //            _Conversation.Switchboard.SessionClosed += new .SBChangedEventHandler(SessionClosed);
            //            _Conversation.Switchboard.ContactJoined += new .ContactChangedEventHandler(ContactJoined);
            //            _Conversation.Switchboard.ContactLeft   += new .ContactChangedEventHandler(ContactLeft);
        }
Ejemplo n.º 10
0
 public MsnBot()
 {
     this.messenger = new Messenger();
 }
        public override void ActivateOptions()
        {
            base.ActivateOptions();

              _messenger = new Messenger
                     {
                       Credentials = new Credentials(Username, Password, MsnProtocol.MSNP21),
                     };

              _messenger.ConnectingException += (sender, args) =>
                                          {
                                            if (LogLog.IsErrorEnabled)
                                            {
                                              LogLog.Error("Connection error", args.Exception);
                                            }
                                          };
              _messenger.Nameserver.ExceptionOccurred += (sender, args) =>
                                                   {
                                            if (LogLog.IsErrorEnabled)
                                            {
                                              LogLog.Error("General error", args.Exception);
                                            }
                                                   };

              _messenger.Nameserver.AuthenticationError += (sender, args) =>
                                                     {
                                            if (LogLog.IsErrorEnabled)
                                            {
                                              LogLog.Error("Authentication error", args.Exception);
                                            }
                                                     };

              _messenger.Nameserver.ServerErrorReceived+= (sender, args) =>
                                                    {
                                                      if (LogLog.IsErrorEnabled)
                                                      {
                                                        LogLog.Error("Server error: " + args.Description +
                                                                     "\n(MSN Error:" +
                                                                     args.MSNError + ")");
                                                      }
                                                    };

              _messenger.ContactService.SynchronizationCompleted += (sender, args) =>
                                                              {
                                                                lock (_contacts)
                                                                {
                                                                  if (LogLog.IsDebugEnabled)
                                                                  {
                                                                    LogLog.Debug("Adding contacts");
                                                                  }

                                                                  foreach (var contact in _messenger.ContactList.All)
                                                                  {
                                                                    _contacts[contact.CID] = contact;
                                                                  }
                                                                }
                                                              };

              _messenger.Nameserver.ContactOnline += (sender, args) =>
                                               {
                                                 lock (_contacts)
                                                 {
                                                   if (LogLog.IsDebugEnabled)
                                                   {
                                                     LogLog.Debug("Contact " + args.Contact.Account + " has come online");
                                                   }

                                                   _contacts[args.Contact.CID] = args.Contact;
                                                 }
                                               };
              _messenger.Nameserver.ContactOnline += (sender, args) =>
                                               {
                                                 lock (_contacts)
                                                 {
                                                   if (LogLog.IsDebugEnabled)
                                                   {
                                                     LogLog.Debug("Contact " + args.Contact.Account + " has gone offline");
                                                   }

                                                   var contactId = args.Contact.CID;
                                                   Contact contact;
                                                   if (_contacts.TryGetValue(contactId, out contact))
                                                   {
                                                     _contacts.Remove(contactId);
                                                   }
                                                 }
                                               };

              _messenger.ContactService.FriendshipRequested +=
            (sender, args) => _messenger.ContactService.AddNewContact(args.Contact.Account);

              _messenger.Connect();
        }
Ejemplo n.º 12
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.m_windows = new Hashtable();
            this.ContactsCollection = new ContactCollection();

            this.m_contacts = new Contacts(Properties.Settings.Default.ServerIp, Properties.Settings.Default.ServerPort);
            this.m_contacts.Nickname = tbNickname.Text.ToString();
            this.m_contacts.Reconnect = Properties.Settings.Default.Reconnect;
            this.m_contacts.ReconnectTimeout = Properties.Settings.Default.ReconnectTimeout;
            this.m_contacts.ConnectionStateChanged += new Contacts.ConnectionStateHandler(Contacts_ConnectionStateChanged);
            this.m_contacts.ContactsList += new Contacts.ContactsHandler(Contacts_ContactsList);
            this.m_contacts.ContactsAdd += new Contacts.ContactsHandler(Contacts_ContactsAdd);
            this.m_contacts.ContactsUpdate += new Contacts.ContactsHandler(Contacts_ContactsUpdate);
            this.m_contacts.ContactsDelete += new Contacts.ContactsHandler(Contacts_ContactsDelete);
            this.m_contacts.Connect();

            this.m_server = new Server(Properties.Settings.Default.ClientPort);
            this.m_server.ConnectionAccepted += new Server.ConnectionAcceptedHandler(Server_ConnectionAccepted);
            this.m_server.Listen();

            this.m_messenger = new Messenger();
            this.m_messenger.Nameserver.SignedIn += new EventHandler<EventArgs>(Nameserver_SignedIn);
            this.m_messenger.Nameserver.SignedOff += new EventHandler<SignedOffEventArgs>(Nameserver_SignedOff);
            this.m_messenger.Owner.DisplayImageChanged += new EventHandler<EventArgs>(Owner_DisplayImageChanged);
            this.m_messenger.ConversationCreated += new EventHandler<ConversationCreatedEventArgs>(m_messenger_ConversationCreated);
            this.m_messenger.ContactService.ReverseAdded += new EventHandler<ContactEventArgs>(ContactService_ReverseAdded);
        }
Ejemplo n.º 13
0
 public MsnConversation(MSNPSharp.Messenger messenger, IMCommands imCommands, Contact contact)
     : base(imCommands)
 {
     _messenger = messenger;
     _contact = contact;
 }
Ejemplo n.º 14
0
 public MsnConversations(MSNPSharp.Messenger messenger, IMCommands imCommands)
 {
     _messenger  = messenger;
     _imCommands = imCommands;
 }
Ejemplo n.º 15
0
 public MsnConversations(MSNPSharp.Messenger messenger, IMCommands imCommands)
 {
     _messenger = messenger;
     _imCommands = imCommands;
 }
Ejemplo n.º 16
0
        public void Login()
        {
            messenger = new Messenger();
            SetEvent();
            /*
            if (messenger.Connected)
            {
                SetStatus("Disconnecting from server");
                messenger.Disconnect();
            }
            */
            // set the credentials, this is ofcourse something every MSNPSharp program will need to implement.

            messenger.Credentials = new Credentials(this.name, this.psw, MsnProtocol.MSNP18);
            if (proxy)
            {
                messenger.ConnectivitySettings.ProxyHost = this.proxyhost;
                messenger.ConnectivitySettings.ProxyPort = int.Parse(this.proxyport);
            }

            // inform the user what is happening and try to connecto to the messenger network.
            SetStatus("Connecting to server");
            action();

            messenger.Connect();
        }
Ejemplo n.º 17
0
 public MsnConversation(MSNPSharp.Messenger messenger, IMCommands imCommands, Contact contact)
     : base(imCommands)
 {
     _messenger = messenger;
     _contact   = contact;
 }