void LogSessionStart() { DoHistoryAction(manager => { sessionLogged = true; IBuddy primaryBuddy = Buddies.FirstOrDefault(); var newSession = new Session() { Id = session.Id.ToString(), ContactId = primaryBuddy.Id, ContactName = primaryBuddy.DisplayName, Start = DateTime.Now }; var participants = Buddies.Append(self) .Select(b => new Participant() { Id = Guid.NewGuid().ToString(), ContactId = b.Id, ContactName = b.DisplayName, }).ToList(); manager.AddSession(newSession, participants); }); }
public void Invite(IBuddy buddy) { if (buddy != null && chatSession != null && !Buddies.Contains(buddy)) { chatSession.Invite(buddy); } }
private void HandleConfig(String flap) { StringReader sr = new StringReader(flap); string group = string.Empty, buddyName = string.Empty; while (sr.Peek() != -1) { switch (sr.Read()) { case 'g': if (Protocol == ProtocolVersion.TOCv2) { sr.Read(); } group = sr.ReadLine().Trim(); break; case 'b': if (Protocol == ProtocolVersion.TOCv2) { sr.Read(); } buddyName = sr.ReadLine().Trim(); Buddies.Add(new BuddyInfo(buddyName, group)); break; } } if (Config != null) { Config(this, EventArgs.Empty); } }
public void RemoveBuddy(string buddy) { _sw.WriteLine("REMOVE BUDDY {0}", buddy); _sw.Flush(); Buddies.Remove(_buddyList.GetBuddy(buddy)); }
void PrimaryBuddy_Online(object sender, EventArgs e) { Dispatcher.Invoke(() => { if (!IsGroupChat && Buddies.Contains(PrimaryBuddy)) { buddyOfflineMessage.Visibility = Visibility.Collapsed; } }); }
void OnBuddyLeft(IBuddy buddy) { if (buddy == PrimaryBuddy && Buddies.Any()) { PrimaryBuddy = Buddies.FirstOrDefault(); } StopMonitoring(buddy); chatTextBox.AddInfo(String.Format("{0} " + Translation.Instance.ChatWindow_HasLeftConversation, buddy.DisplayName)); OnParticipantsChanged(); }
void chatClient_BuddyOnline(object sender, BuddyOnlineEventArgs e) { if (Buddies.Contains(e.Buddy)) { OnContactListUpdated(); } else { dispatcher.Invoke(() => Buddies.Add(e.Buddy)); } }
void UpdateTitle() { if (IsBroadcastChat) { this.Title = Translation.Instance.ChatWindow_BroadCastChatTitle; } else { string title = String.Join(", ", Buddies.Select(b => b.DisplayName).ToArray()); this.Title = String.IsNullOrEmpty(title) ? PrimaryBuddy.DisplayName : title; } }
void PrimaryBuddy_Offline(object sender, EventArgs e) { Dispatcher.Invoke(() => { if (!IsGroupChat && Buddies.Contains(PrimaryBuddy)) { buddyOfflineMessage.DataContext = PrimaryBuddy.DisplayName; buddyOfflineMessage.Visibility = Visibility.Visible; /* since ZeroMQ doesn't report failure and if the user comes online with new ip/port then existing * session will continue to talk to old endpoint. Therefore destroy the session */ DestroySession(); } }); }
/// <summary> /// Sets the server configuration to match the contents of <see cref="Buddies"/>. /// </summary> public void SetConfig() { BuddyInfo[] buddies = Buddies.SortBuddyList(); StringBuilder config = new StringBuilder(); string group = null; foreach (BuddyInfo buddy in buddies) { if (group != buddy.Group) { group = buddy.Group; config.Append("g " + group + "\n"); } config.Append("b " + buddy.ScreenName + "\n"); } SendFlap(FrameType.Data, "toc_set_config \"" + config.ToString() + "\""); }
private void SendEmail_Click(object sender, RoutedEventArgs e) { string to = String.Join(";", Buddies.Select(buddy => buddy.Properties.EmailAddress).ToArray()); System.Diagnostics.Process.Start("mailto:" + to); }
private void InviteContactMenu_Click(object sender, RoutedEventArgs e) { IEnumerable <Buddy> buddies = SquiggleUtility.SelectContacts(Translation.Instance.ChatWindow_InviteContact, this, b => Buddies.Contains(b)); Invite(buddies); }