ICQ-клиент

Автор: Пользователь скрыл имя, 08 Апреля 2012 в 14:17, курсовая работа

Описание работы

В первые годы существования Всемирной паутины пользователи общались преимущественно через электронную почту, но отправлять письма было неудобно и даже нерационально, если оба собеседника одновременно находились в Интернете. Все изменилось, когда появились первые программы мгновенного общения или, менее официально, мессенджеры или интернет-пейджеры.

Содержание

Введение 5
1 Аналитический обзор литературы
1.1 Анализ предметной области
1.2 Сравнительная характеристика существующих аналогов 8
1.3 Постановка задачи 10
2 Модели, положенные в основу ПС
2.1 Функциональные модели
2.2 Разработка спецификации требований к программному средству 13
3 Разработка программного средства
3.1 Обоснование выбора среды разаработки
3.2 Особенности реализации
3.3 Разработка программной архитектуры
4 Тестирование программного средства
5 Методика работы с программным средством 20
Заключение
Список использованных источников
Приложение A. Листинг программного средства

Работа содержит 1 файл

KursKSIS.doc

— 841.00 Кб (Скачать)

                    }

                    _screenname = value;

 

                    // TODO:  Actually reset the formatting...

                }

            }

        }

 

        /// <summary>

        /// Gets or sets the port number used for OSCAR logins

        /// </summary>

        /// <remarks>

        /// Traditionally, this is port 5190; however, AIM 6 has been caught using port 443 to negotiate

        /// connections with login.oscar.aol.com and ars.oscar.aol.com.  Future versions of OscarLib may use

        /// this property to support login via port 443.

        /// </remarks>

        public ushort LoginPort

        {

            get { return _loginport; }

            internal set { _loginport = value; }

        }

 

        /// <summary>

        /// Gets or sets this session's OSCAR identification information

        /// </summary>

        /// <exception cref="LoggedInException">Thrown when the <see cref="Session"/> is already logged in</exception>

        public OSCARIdentification ClientIdentification

        {

            get { return _clientid; }

        }

 

        /// <summary>

        /// Gets or sets the OSCAR capabilities associated with the session

        /// </summary>

        /// <remarks>

        /// The client capabilities must be set before the session is logged in because the

        /// client's capabilities are communicated during the login process and are kept through

        /// the session.

        /// </remarks>

        /// <exception cref="LoggedInException">Thrown when the <see cref="Session"/> is already logged in</exception>

        public Capabilities ClientCapabilities

        {

            get { return _caps; }

            set

            {

                if (LoggedIn)

                {

                    throw new LoggedInException("Client capabilities cannot be set after the session is logged in");

                }

                _caps = value;

                if ((value & Capabilities.UTF8) == Capabilities.UTF8)

                {

                    encoding = Encoding.UTF8;

                }

                else

                {

                    encoding = Encoding.ASCII;

                }

            }

        }

 

        /// <summary>

        /// Gets the recommended enocding format depending on the client capability settings

        /// </summary>

        public Encoding Encoding

        {

            get { return encoding; }

        }

 

        /// <summary>

        /// Gets a value indicating whether this client has completed the login process

        /// </summary>

        public bool LoggedIn

        {

            get { return _loggedin; }

            protected set { _loggedin = value; }

        }

 

        /// <summary>

        /// Gets the <see cref="SSIManager"/> associated with this session

        /// </summary>

        public SSIManager SSI

        {

            get { return ssiManager; }

        }

 

        /// <summary>

        /// Gets the <see cref="LimitManager"/> associated with this session

        /// </summary>

        public LimitManager Limits

        {

            get { return limitManager; }

        }

 

        /// <summary>

        /// Gets the <see cref="IcqManager"/> associated with this session

        /// </summary>

        public IcqManager ICQ

        {

            get { return icqManager; }

        }

 

        /// <summary>

        /// Gets the <see cref="MessageManager"/> associated with this session

        /// </summary>

        public MessageManager Messages

        {

            get { return messageManager; }

        }

 

        /// <summary>

        /// Gets the <see cref="ChatRoomManager"/> associated with this session

        /// </summary>

        public ChatRoomManager ChatRooms

        {

            get { return chatRoomManager; }

        }

 

        /// <summary>

        /// Gets the <see cref="GraphicsManager"/> associated with this session

        /// </summary>

        public GraphicsManager Graphics

        {

            get { return graphicsManager; }

        }

 

        /// <summary>

        /// Gets the <see cref="StatusManager"/> associated with this session

        /// </summary>

        public StatusManager Statuses

        {

            get { return statusManager; }

        }

 

        /// <summary>

        /// Gets the <see cref="SearchManager"/> associated with this session

        /// </summary>

        public SearchManager Searches

        {

            get { return searchManager; }

        }

 

        /// <summary>

        /// Gets or sets a filesystem path where OscarLib can place received data

        /// </summary>

        /// <remarks>During an OSCAR Direct Connect session, "transient" files may come over the wire.

        /// If ScratchPath is set to a valid path, OscarLib will save the files locally and return

        /// <see cref="System.IO.FileStream"/> references to the objects. Otherwise, the files will

        /// be returned as <see cref="System.IO.MemoryStream"/> objects, which will take more active memory.</remarks>

        public string ScratchPath { get; set; }

 

        /// <summary>

        /// Gets the <see cref="ConnectionManager"/> associated with this session

        /// </summary>

        internal ConnectionManager Connections

        {

            get { return connectionManager; }

        }

 

        /// <summary>

        /// Gets the <see cref="ServiceManager"/> associated with this session

        /// </summary>

        internal ServiceManager Services

        {

            get { return serviceManager; }

        }

 

        /// <summary>

        /// Gets the <see cref="PacketDispatcher"/> associated with this session

        /// </summary>

        internal PacketDispatcher Dispatcher

        {

            get { return dispatcher; }

        }

 

        /// <summary>

        /// Gets the <see cref="FamilyManager"/> associated with this session

        /// </summary>

        internal FamilyManager Families

        {

            get { return familyManager; }

        }

 

        /// <summary>

        /// Gets the <see cref="RateClassManager"/> associated with this session

        /// </summary>

        internal RateClassManager RateClasses

        {

            get { return rateManager; }

        }

 

        /// <summary>

        /// Gets the <see cref="AuthorizationManager"/> associated with this session

        /// </summary>

        internal AuthorizationManager Authorization

        {

            get { return authManager; }

        }

 

        #endregion

 

        /// <summary>

        /// Gets or Sets the last modification date and time of the buddylist

        /// </summary>

        public DateTime LastModificationDate { get; set; }

 

        #region Public events and protected event firing functions

 

        #region OscarLib-generated events

 

        /// <summary>

        /// Occurs when an unhandled exception is raised in the course of dispatching and processing a packet

        /// </summary>

        public event PacketDispatchExceptionHandler PacketDispatchException;

 

        /// <summary>

        /// Raises the <see cref="PacketDispatchException"/> event

        /// </summary>

        protected internal void OnPacketDispatchException(Exception ex, DataPacket packet)

        {

            if (PacketDispatchException != null)

            {

                PacketDispatchException(this, new PacketDispatchExceptionArgs(ex, packet));

            }

        }

 

        /// <summary>

        /// Occurs when the library generates a status update message

        /// </summary>

        public event InformationMessageHandler StatusUpdate;

 

        /// <summary>

        /// Raises the <see cref="StatusUpdate"/> event

        /// </summary>

        /// <param name="message">A status message</param>

        protected internal void OnStatusUpdate(string message)

        {

            if (StatusUpdate != null)

                StatusUpdate(this, message);

        }

 

        /// <summary>

        /// Occurs when the library generates a status update message during login

        /// </summary>

        public event LoginStatusUpdateHandler LoginStatusUpdate;

 

        /// <summary>

        /// Raises the <see cref="LoginStatusUpdate"/> event

        /// </summary>

        /// <param name="message">A status message</param>

        /// <param name="percentdone">The percentage of the login progress that has been completed</param>

        protected internal void OnLoginStatusUpdate(string message, double percentdone)

        {

            if (LoginStatusUpdate != null)

            {

                LoginStatusUpdate(this, message, percentdone);

            }

        }

 

        /// <summary>

        /// Occurs when the library generates a warning message

        /// </summary>

        public event WarningMessageHandler WarningMessage;

 

        /// <summary>

        /// Raises the <see cref="WarningMessage"/> event

        /// </summary>

        /// <param name="errorcode">A <see cref="ServerErrorCode"/> describing the warning</param>

        protected internal void OnWarning(ServerErrorCode errorcode)

        {

            // csammis:  Losing a secondary connection (chat room, icon downloader)

            // isn't cause for logging off the session...and setting LoggedIn to false

            // doesn't log off the session anyway.  Call .Logoff() for that.

 

            //if (errorcode == ServerErrorCode.LostSecondaryConnection)

            //    this.LoggedIn = false;

 

            if (WarningMessage != null)

            {

                WarningMessage(this, errorcode);

            }

        }

 

        /// <summary>

        /// Occurs when the library generates an error message

        /// </summary>

        public event ErrorMessageHandler ErrorMessage;

 

        /// <summary>

        /// Raises the <see cref="ErrorMessage"/> event or the <see cref="LoginFailed"/> event

        /// </summary>

        /// <param name="errorcode">A <see cref="ServerErrorCode"/> describing the error</param>

        /// <remarks>If the login process has not completed, <see cref="LoginFailed"/> is raised.

        /// Otherwise, <see cref="ErrorMessage"/> is raised.</remarks>

        protected internal void OnError(ServerErrorCode errorcode)

        {

            if (!_loggedin)

            {

                if (LoginFailed != null)

                {

                    if (errorcode == ServerErrorCode.LostBOSConnection)

                    {

                        LoggedIn = false;

                        LoginFailed(this, LoginErrorCode.CantReachBOSServer);

                    }

                    else

                        LoginFailed(this, LoginErrorCode.UnknownError);

                }

            }

            else

            {

                if (ErrorMessage != null)

                    ErrorMessage(this, errorcode);

            }

        }

 

        #endregion

 

        #region SNAC01 events

 

        /// <summary>

        /// Occurs when the login process is complete.

        /// </summary>

        public event LoginCompletedHandler LoginCompleted;

 

        /// <summary>

        /// Raises the <see cref="LoginCompleted"/> event

        /// </summary>

        protected internal void OnLoginComplete()

        {

            LoggedIn = true;

            if (LoginCompleted != null)

            {

                LoginCompleted(this);

            }

        }

 

        /// <summary>

        /// Occurs when a remote client has warned this client

        /// </summary>

        public event WarningReceivedHandler WarningReceived;

 

        /// <summary>

        /// Raises the <see cref="WarningReceived"/> event.

        /// </summary>

        /// <param name="newlevel">The client's new warning level</param>

        /// <param name="anonymous"><c>true</c> if this warning was sent anonymously, <c>false</c> otherwise</param>

        /// <param name="ui">A <see cref="UserInfo"/> structure describing the warning user. If <paramref name="anonymous"/> is

        /// <c>true</c>, this structure is unpopulated</param>

        protected internal void OnWarningReceived(ushort newlevel, bool anonymous, UserInfo ui)

        {

            if (WarningReceived != null)

                WarningReceived(this, newlevel, anonymous, ui);

        }

 

        #endregion

 

        #region SNAC02 events

 

        /// <summary>

        /// Occurs when the server sends acknowledgement of a directory update request

        /// </summary>

        public event DirectoryUpdateAcknowledgedHandler DirectoryUpdateAcknowledged;

 

        /// <summary>

        /// Raises the <see cref="DirectoryUpdateAcknowledged"/> event

        /// </summary>

        /// <param name="success"><c>true</c> if the directory update succeded, and <c>false</c> otherwise</param>

        protected internal void OnDirectoryUpdateAcknowledged(bool success)

        {

            if (DirectoryUpdateAcknowledged != null)

                DirectoryUpdateAcknowledged(this, success);

        }

 

        #endregion

 

        #region SNAC04 events

 

        /// <summary>

        /// Occurs when a file transfer request is received

        /// </summary>

        public event FileTransferRequestReceivedHandler FileTransferRequestReceived;

 

        /// <summary>

        /// Occurs when a Direct IM transfer request is received

        /// </summary>

        public event DirectIMRequestReceivedHandler DirectIMRequestReceived;

 

        /// <summary>

        /// Raises the <see cref="FileTransferRequestReceived"/> event

        /// </summary>

        /// <param name="key">The unique key needed to respond to this request</param>

        protected internal void OnDirectConnectionRequestReceived(Cookie key)

        {

            DirectConnection conn = Connections.GetDirectConnectionByCookie(key);

 

            if (conn is FileTransferConnection && FileTransferRequestReceived != null)

            {

                var ftc = conn as FileTransferConnection;

                FileTransferRequestReceived(this, ftc.Other, ftc.VerifiedIP, ftc.FileHeader.Name,

                                            ftc.TotalFileSize, ftc.Message, key);

            }

            else if (conn is DirectIMConnection && DirectIMRequestReceived != null)

            {

                DirectIMRequestReceived(this, conn.Other, conn.Message, key);

            }

            //else if (rd.DirectConnection.ConnectionType == DirectConnectType.DirectIM &&

            //  this.OscarLib_DirectIMRequestReceived != null)

            //{

            //  this.OscarLib_DirectIMRequestReceived(this, rd.UserInfo);

            //}

        }

 

        /// <summary>

        /// Occurs when a chat room invitation is received

        /// </summary>

        public event ChatInvitationReceivedHandler ChatInvitationReceived;

 

        /// <summary>

        /// Raises the <see cref="ChatInvitationReceived"/> event

        /// </summary>

        /// <param name="sender">A <see cref="UserInfo"/> object represnting the inviter</param>

        /// <param name="roomname">The name of the chatroom</param>

        /// <param name="message">An invitation chatroom</param>

        /// <param name="encoding">The text encoding used in the chatroom</param>

        /// <param name="language">The language used in the chatroom</param>

        /// <param name="key">The unique key needed to respond to this request</param>

        protected internal void OnChatInvitationReceived(UserInfo sender,

                                                         string roomname,

                                                         string message,

                                                         Encoding encoding,

                                                         string language,

                                                         Cookie key)

        {

            if (ChatInvitationReceived != null)

                ChatInvitationReceived(this, sender, roomname, message, encoding, language, key);

        }

 

        #endregion

 

        #region SNAC0F events

 

        /// <summary>

        /// Occurs when the server sends the results of a directory search

        /// </summary>

        public event SearchResultsHandler SearchResults;

 

        /// <summary>

        /// Raises the <see cref="SearchResults"/> event

        /// </summary>

        /// <param name="results">The results of the directory search</param>

        protected internal void OnSearchResults(DirectoryEntry[] results)

        {

            if (SearchResults != null)

                SearchResults(this, results);

Информация о работе ICQ-клиент