/// <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); }
/// <summary> /// /// </summary> /// <param name="friend"></param> public void BlockFriend(Friend friend) { foreach (IProtocolListener listener in this.listenerList) { listener.OnBlockFriend(friend); } }
/// <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); }
/// <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); }
/// <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; }
/// <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; }
/// <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"); }
/// <summary> /// /// </summary> /// <param name="friend"></param> public void OnFriendRemove(Friend friend) { }
/// <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"); } }
/// <summary> /// /// </summary> /// <param name="friend"></param> public void OnFriendJoin(Friend friend) { this.WriteEventToConvoBox(friend.Username + " has joined the conversation"); }
/// <summary> /// /// </summary> /// <param name="friend"></param> public void OnFriendAdd(Friend friend) { }
/// <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; }
/// <summary> /// /// </summary> /// <param name="friend"></param> /// <param name="reason"></param> /// <param name="enableAddCheckbox"></param> public void OnPromptForStrangerHasAddedMe(Friend friend, string reason, bool enableAddCheckbox) { }
/// <summary> /// /// </summary> /// <param name="friend"></param> public void OnTypingNotification(Friend friend) { }
/// <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(); }
/// <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); } } } }
/// <summary> /// /// </summary> /// <param name="friend"></param> public void OnFriendLeave(Friend friend) { }
/// <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); } }
/// <summary> /// /// </summary> /// <param name="friend"></param> public void RemoveFriendFromList(Friend friend) { foreach (IProtocolListener listener in this.listenerList) { listener.OnRemoveFriendFromList(friend); } }
/// <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); }
/// <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); } }
/// <summary> /// /// </summary> /// <param name="friend"></param> /// <param name="opCompleteEvent"></param> /// <param name="tag"></param> public void OnInvitedToConversation(Friend friend, OperationCompleteEvent opCompleteEvent, object tag) { }
/// <summary> /// /// </summary> /// <param name="friend"></param> /// <param name="filename"></param> public void OnFileSendInvitation(Friend friend, string filename) { }
/// <summary> /// /// </summary> /// <param name="friend"></param> public void OnRemoveFriendFromList(Friend friend) { }
/// <summary> /// /// </summary> /// <param name="friend"></param> /// <param name="text"></param> public void OnFriendSay(Friend friend, string text) { }
/// <summary> /// /// </summary> /// <param name="friend"></param> public void OnUnblockFriend(Friend friend) { }
/// <summary> /// /// </summary> /// <param name="friend"></param> /// <returns></returns> public bool ContainsFriend(Friend friend) { return this.friendsList.Contains(friend); }
/// <summary> /// /// </summary> /// <param name="friend"></param> public void OnBlockFriend(Friend friend) { }
/// <summary> /// /// </summary> /// <param name="friend"></param> /// <returns></returns> public bool ContainsFriend(Friend friend) { return(this.friendsList.Contains(friend)); }