Пример #1
0
 /// <summary>
 /// Constructs a FriendTreeNode
 /// </summary>
 /// <param name="protocol">Associated protocol</param>
 /// <param name="friend">Associated friend</param>
 public FriendTreeNode(Protocol protocol, Friend friend)
 {
     this.protocol = protocol;
     this.friend = friend;
     this.Tag = friend;
     this.Text = friend.DisplayName;
 }
 /// <summary>
 /// When a file invitation is received by another party
 /// </summary>
 /// <param name="friend">Friend who's sending the file</param>
 /// <param name="filename">Filename of file</param>
 public void FileSendInvitation(Friend friend, string filename)
 {
     foreach (IConversationListener listener in this.listenerList)
     {
         listener.OnFileSendInvitation(friend, filename);
     }
 }
 /// <summary>
 /// Call this when a file transfer invitation is received by someone else
 /// </summary>
 /// <param name="username">Friend who's sending the file</param>
 /// <param name="filename">Filename</param>
 public void FileSendInvitation(string username, string filename)
 {
     Friend friend = this.protocolServer.GetFriend(username);
     if (friend == null)
         friend = new Friend(username, OnlineStatus.Online, null);
     FileSendInvitation(friend, filename);
 }
Пример #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 public void BlockFriend(Friend friend)
 {
     foreach (IProtocolListener listener in this.listenerList)
     {
         listener.OnBlockFriend(friend);
     }
 }
Пример #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="friend"></param>
        public void AddFriend(Friend friend)
        {
            foreach (IProtocolListener listener in this.listenerList)
            {
                friend.AddListener(listener);
                listener.OnFriendAdd(friend);
            }

            this.friendsList.Add(friend);
        }
Пример #6
0
        /// <summary>
        /// Constructs a friend menu.
        /// </summary>
        /// <param name="protocol">Associated protocol</param>
        /// <param name="friend">Associated friend</param>
        public FriendMenu(Protocol protocol, Friend friend)
        {
            this.protocol = protocol;
            this.friend = friend;

            this.MenuItems.Add("Remove", new EventHandler(menuItemRemove_Click));

            this.blockItem = new WinForms.MenuItem();

            this.blockItem.Text = (friend.Blocked ? "Unblock" : "Block");
            this.blockItem.Click += new EventHandler(menuItemBlock_Click);

            this.MenuItems.Add(blockItem);
        }
Пример #7
0
        /// <summary>
        /// Constructs an OnFriendAddForm form.
        /// </summary>
        /// <param name="protocol">Associated protocol</param>
        /// <param name="friend">Person who's added you to their list</param>
        /// <param name="reason">[optional] Stranger's message</param>
        /// <param name="enableAddCheckbox">Whether to enable the add user checkbox</param>
        public OnFriendAddForm(IProtocol protocol, Friend friend, string reason, bool enableAddCheckbox)
        {
            this.protocol = protocol;
            this.friend = friend;

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.label.Text = friend.DisplayName + " (" + friend.Username + ") "
                + "has added you to their contact list";
            this.textBox.Text = reason;
            this.addUserCheckBox.Enabled = enableAddCheckbox;

            this.allowUserRadioButton.Checked = true;
        }
Пример #8
0
        /// <summary>
        /// Constructs a MessageForm
        /// </summary>
        /// <param name="protocol">Associated protocol</param>
        /// <param name="originalFriend">Initial friend</param>
        public MessageForm(Protocol protocol, Friend originalFriend)
        {
            this.protocol = protocol;
            this.originalFriend = originalFriend;

            this.log = LogFactory.CreateLog(protocol, originalFriend.Username);

            this.protocol.AddListener(this);

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // set main text
            this.Text = originalFriend.DisplayName + " (" + originalFriend.Username + ") " + " - " + protocol.Name;

            // setup typing notification timer
            typingNotifyTimer.AutoReset = false;
            typingNotifyTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTypingNotifyTimerElapse);

            // enable file transfer
            this.toolBar.Buttons[0].Enabled = this.protocol.Settings.Constants.SupportsFileTransfer;
        }
Пример #9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="friend"></param>
        public void OnFriendLeave(Friend friend)
        {
            // if the original friend has left, set the need reconnect flag to true.
            if (friend.Equals(this.originalFriend))
            {
                this.conversationConnected = false;
            }

            this.WriteEventToConvoBox(friend.Username + " has left the conversation");
        }
Пример #10
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 public void OnFriendRemove(Friend friend)
 {
 }
Пример #11
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="status"></param>
 public void OnFriendChangeStatus(Friend friend, OnlineStatus status)
 {
     if (friend.Equals(this.originalFriend))
     {
         if (status != OnlineStatus.Offline)
             this.WriteEventToConvoBox(friend.Username + " has changed status to " + status.ToString());
         else
             this.WriteEventToConvoBox(friend.Username + " has signed off");
     }
 }
Пример #12
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 public void OnFriendJoin(Friend friend)
 {
     this.WriteEventToConvoBox(friend.Username + " has joined the conversation");
 }
Пример #13
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 public void OnFriendAdd(Friend friend)
 {
 }
Пример #14
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="newName"></param>
 public void OnFriendChangeDisplayName(Friend friend, string newName)
 {
     if (friend.Equals(this.originalFriend))
         this.Text = newName;
 }
Пример #15
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="reason"></param>
 /// <param name="enableAddCheckbox"></param>
 public void OnPromptForStrangerHasAddedMe(Friend friend, string reason, bool enableAddCheckbox)
 {
 }
Пример #16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 public void OnTypingNotification(Friend friend)
 {
 }
Пример #17
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="friend"></param>
        public void OnTypingNotification(Friend friend)
        {
            this.statusBar.Text = friend.Username + " is typing a message";

            // start timer
            typingNotifyTimer.Stop();
            typingNotifyTimer.Start();
        }
Пример #18
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="friend"></param>
        /// <param name="text"></param>
        public void OnFriendSay(Friend friend, string text)
        {
            if (text != null && text != string.Empty && text != "")
            {
                this.statusBar.Text = "";
                this.typingNotifyTimer.Stop();

                protocol.Invoke(new ShowFormHandler(ShowForm));
                this.WriteToConversationBox(friend.DisplayName, text, this.friendSpeakColour);

                // only flash or play sound if this is not the active form
                if (WinForms.Form.ActiveForm != this)
                {
                    switch (GlobalSettings.Instance().FriendMessageEvent)
                    {
                        default:
                        case FriendMessageEvent.DoNothing:
                            break;

                        case FriendMessageEvent.FlashWindow:
                        {
                            NativeMethods.FlashWindow(this,
                                (uint)GlobalSettings.Instance().NumTimesToFlashOnMessageReceived,
                                FlashWindowFlags.FlashTray);
                        }
                            break;
                    }

                    if (GlobalSettings.Instance().PlaySoundOnMessageReceived)
                    {
                        NativeMethods.PlaySoundFromFile(GlobalSettings.Instance().SoundOnMessageReceived,
                            PlaySoundFlags.NoDefault | PlaySoundFlags.Asynchronous);
                    }
                }
            }
        }
Пример #19
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 public void OnFriendLeave(Friend friend)
 {
 }
Пример #20
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="opCompleteEvent"></param>
 /// <param name="tag"></param>
 public void StartInvitedConversation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag)
 {
     foreach (IProtocolListener listener in this.listenerList)
     {
         listener.OnInvitedToConversation(friend, opCompleteEvent, tag);
     }
 }
Пример #21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 public void RemoveFriendFromList(Friend friend)
 {
     foreach (IProtocolListener listener in this.listenerList)
     {
         listener.OnRemoveFriendFromList(friend);
     }
 }
Пример #22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="friend"></param>
        public void RemoveFriend(Friend friend)
        {
            foreach (IProtocolListener listener in this.listenerList)
            {
                friend.RemoveListener(listener);
                listener.OnFriendRemove(friend);
            }

            this.friendsList.Remove(friend);
        }
Пример #23
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="reason"></param>
 /// <param name="enableAddCheckbox"></param>
 public void PromptForStrangerHasAddedMe(Friend friend, string reason, bool enableAddCheckbox)
 {
     foreach (IProtocolListener listener in this.listenerList)
     {
         listener.OnPromptForStrangerHasAddedMe(friend, reason, enableAddCheckbox);
     }
 }
Пример #24
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="opCompleteEvent"></param>
 /// <param name="tag"></param>
 public void OnInvitedToConversation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag)
 {
 }
Пример #25
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="filename"></param>
 public void OnFileSendInvitation(Friend friend, string filename)
 {
 }
Пример #26
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 public void OnRemoveFriendFromList(Friend friend)
 {
 }
Пример #27
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="text"></param>
 public void OnFriendSay(Friend friend, string text)
 {
 }
Пример #28
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 public void OnUnblockFriend(Friend friend)
 {
 }
Пример #29
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <returns></returns>
 public bool ContainsFriend(Friend friend)
 {
     return this.friendsList.Contains(friend);
 }
Пример #30
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 public void OnBlockFriend(Friend friend)
 {
 }
Пример #31
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="friend"></param>
 /// <returns></returns>
 public bool ContainsFriend(Friend friend)
 {
     return(this.friendsList.Contains(friend));
 }