//
// Radegast Metaverse Client
-// Copyright (c) 2009-2010, Radegast Development Team
+// Copyright (c) 2009-2014, Radegast Development Team
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
client.Self.GroupChatJoined += new EventHandler<GroupChatJoinedEventArgs>(Self_GroupChatJoined);
client.Self.ChatSessionMemberAdded += new EventHandler<ChatSessionMemberAddedEventArgs>(Self_ChatSessionMemberAdded);
client.Self.ChatSessionMemberLeft += new EventHandler<ChatSessionMemberLeftEventArgs>(Self_ChatSessionMemberLeft);
- client.Avatars.UUIDNameReply += new EventHandler<UUIDNameReplyEventArgs>(Avatars_UUIDNameReply);
+ instance.Names.NameUpdated += new EventHandler<UUIDNameReplyEventArgs>(Names_NameUpdated);
instance.Netcom.ClientConnected += new EventHandler<EventArgs>(Netcom_Connected);
instance.Netcom.ClientDisconnected += new EventHandler<DisconnectedEventArgs>(Netcom_Disconnected);
instance.GlobalSettings.OnSettingChanged += new Settings.SettingChangedCallback(GlobalSettings_OnSettingChanged);
client.Self.GroupChatJoined -= new EventHandler<GroupChatJoinedEventArgs>(Self_GroupChatJoined);
client.Self.ChatSessionMemberAdded -= new EventHandler<ChatSessionMemberAddedEventArgs>(Self_ChatSessionMemberAdded);
client.Self.ChatSessionMemberLeft -= new EventHandler<ChatSessionMemberLeftEventArgs>(Self_ChatSessionMemberLeft);
- client.Avatars.UUIDNameReply -= new EventHandler<UUIDNameReplyEventArgs>(Avatars_UUIDNameReply);
+ instance.Names.NameUpdated -= new EventHandler<UUIDNameReplyEventArgs>(Names_NameUpdated);
instance.Netcom.ClientConnected -= new EventHandler<EventArgs>(Netcom_Connected);
instance.Netcom.ClientDisconnected -= new EventHandler<DisconnectedEventArgs>(Netcom_Disconnected);
instance.GlobalSettings.OnSettingChanged -= new Settings.SettingChangedCallback(GlobalSettings_OnSettingChanged);
{
if (e.Key == "chat_font_size")
UpdateFontSize();
+ else if (e.Key == "display_name_mode")
+ UpdateParticipantList();
}
void Netcom_Disconnected(object sender, DisconnectedEventArgs e)
RefreshControls();
}
- void Avatars_UUIDNameReply(object sender, UUIDNameReplyEventArgs e)
+ void Names_NameUpdated(object sender, UUIDNameReplyEventArgs e)
{
if (InvokeRequired)
{
if (!instance.MonoRuntime || IsHandleCreated)
- BeginInvoke(new MethodInvoker(() => Avatars_UUIDNameReply(sender, e)));
+ BeginInvoke(new MethodInvoker(() => Names_NameUpdated(sender, e)));
return;
}
Participants.Items.Clear();
List<ChatSessionMember> participants;
- List<UUID> nameLookup = new List<UUID>();
if (client.Self.GroupChatSessions.TryGetValue(session, out participants))
{
ChatSessionMember participant = members[i];
ListViewItem item = new ListViewItem();
item.Name = participant.AvatarKey.ToString();
- if (instance.nameCache.ContainsKey(participant.AvatarKey))
- {
- item.Text = instance.nameCache[participant.AvatarKey];
- }
- else
- {
- item.Text = RadegastInstance.INCOMPLETE_NAME;
- nameLookup.Add(participant.AvatarKey);
- }
+ item.Text = instance.Names.Get(participant.AvatarKey);
+ item.Tag = participant.AvatarKey;
+
if (participant.IsModerator)
item.Font = new Font(item.Font, FontStyle.Bold);
Participants.Items.Add(item);
}
-
- if (nameLookup.Count > 0)
- client.Avatars.RequestAvatarNames(nameLookup);
}
Participants.Sort();
{
pnlChatInput.Height = cbxInput.Height + 7;
}
+
+ private void avatarContext_Opening(object sender, System.ComponentModel.CancelEventArgs e)
+ {
+ if (Participants.SelectedItems.Count != 1)
+ {
+ e.Cancel = true;
+ return;
+ }
+
+ UUID av = (UUID)Participants.SelectedItems[0].Tag;
+
+ if (av == client.Self.AgentID)
+ {
+ ctxMute.Enabled = ctxPay.Enabled = ctxStartIM.Enabled = false;
+ }
+ else
+ {
+ ctxMute.Enabled = ctxPay.Enabled = ctxStartIM.Enabled = true;
+
+ bool isMuted = client.Self.MuteList.Find(me => me.Type == MuteType.Resident && me.ID == av) != null;
+ ctxMute.Text = isMuted ? "Unmute" : "Mute";
+ }
+ }
+
+ private void ctxProfile_Click(object sender, EventArgs e)
+ {
+ if (Participants.SelectedItems.Count != 1) return;
+ UUID av = (UUID)Participants.SelectedItems[0].Tag;
+ string name = instance.Names.Get(av);
+
+ instance.MainForm.ShowAgentProfile(name, av);
+ }
+
+ private void ctxPay_Click(object sender, EventArgs e)
+ {
+ if (Participants.SelectedItems.Count != 1) return;
+ UUID av = (UUID)Participants.SelectedItems[0].Tag;
+ string name = instance.Names.Get(av);
+
+ new frmPay(instance, av, name, false).ShowDialog();
+ }
+
+ private void ctxStartIM_Click(object sender, EventArgs e)
+ {
+ if (Participants.SelectedItems.Count != 1) return;
+ UUID av = (UUID)Participants.SelectedItems[0].Tag;
+ string name = instance.Names.Get(av);
+
+ instance.TabConsole.ShowIMTab(av, name, true);
+ }
+
+ private void ctxOfferTP_Click(object sender, EventArgs e)
+ {
+ if (Participants.SelectedItems.Count != 1) return;
+ UUID av = (UUID)Participants.SelectedItems[0].Tag;
+ client.Self.SendTeleportLure(av, "Join me in " + client.Network.CurrentSim.Name + "!");
+ }
+
+ private void ctxReqestLure_Click(object sender, EventArgs e)
+ {
+ if (Participants.SelectedItems.Count != 1) return;
+ UUID av = (UUID)Participants.SelectedItems[0].Tag;
+ instance.MainForm.AddNotification(new ntfSendLureRequest(instance, av));
+ }
+
+ private void ctxEject_Click(object sender, EventArgs e)
+ {
+ if (Participants.SelectedItems.Count != 1) return;
+ UUID av = (UUID)Participants.SelectedItems[0].Tag;
+ instance.Client.Groups.EjectUser(session, av);
+ }
+
+ private void ctxBan_Click(object sender, EventArgs e)
+ {
+ if (Participants.SelectedItems.Count != 1) return;
+ UUID av = (UUID)Participants.SelectedItems[0].Tag;
+ }
+
+ private void ctxMute_Click(object sender, EventArgs e)
+ {
+ if (Participants.SelectedItems.Count != 1) return;
+ UUID av = (UUID)Participants.SelectedItems[0].Tag;
+ if (av == client.Self.AgentID) return;
+
+ if (ctxMute.Text == "Mute")
+ {
+ client.Self.UpdateMuteListEntry(MuteType.Resident, av, instance.Names.GetLegacyName(av));
+ }
+ else
+ {
+ client.Self.RemoveMuteListEntry(av, instance.Names.GetLegacyName(av));
+ }
+ }
}
}