Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

RAD-352: Offline group notices don't show group name or insignia on l…

…ogin

git-svn-id: https://radegast.googlecode.com/svn/trunk@1286 f7a694da-4d33-11de-9ad6-1127a62b9fcd
  • Loading branch information...
commit 80c63cbde16f60657f01999d3168731b56ea1a7b 1 parent b853e36
@lkalif lkalif authored
Showing with 50 additions and 15 deletions.
  1. +50 −15 Radegast/GUI/Notifications/GroupNoticeNotification.cs
View
65 Radegast/GUI/Notifications/GroupNoticeNotification.cs
@@ -40,15 +40,18 @@ public partial class ntfGroupNotice : Notification
private InstantMessage msg;
private AssetType type = AssetType.Unknown;
private UUID destinationFolderID;
-
+ private UUID groupID;
+ private Group group;
public ntfGroupNotice(RadegastInstance instance, InstantMessage msg)
: base(NotificationType.GroupNotice)
{
InitializeComponent();
+ Disposed += new System.EventHandler(ntfGroupNotice_Disposed);
this.instance = instance;
this.msg = msg;
+ client.Groups.GroupProfile += new System.EventHandler<GroupProfileEventArgs>(Groups_GroupProfile);
if (msg.BinaryBucket.Length > 18 && msg.BinaryBucket[0] != 0)
{
@@ -65,31 +68,44 @@ public ntfGroupNotice(RadegastInstance instance, InstantMessage msg)
btnSave.Visible = icnItem.Visible = txtItemName.Visible = true;
}
- string group = string.Empty;
if (msg.BinaryBucket.Length >= 18)
{
- UUID groupID = new UUID(msg.BinaryBucket, 2);
-
- if (instance.Groups.ContainsKey(groupID))
- {
- group = instance.Groups[groupID].Name;
- if (instance.Groups[groupID].InsigniaID != UUID.Zero)
- {
- imgGroup.Init(instance, instance.Groups[groupID].InsigniaID, string.Empty);
- }
- }
+ groupID = new UUID(msg.BinaryBucket, 2);
+ }
+ else
+ {
+ groupID = msg.FromAgentID;
}
- string text = msg.Message.Replace("\n", System.Environment.NewLine);
int pos = msg.Message.IndexOf('|');
string title = msg.Message.Substring(0, pos);
+ lblTitle.Text = title;
+ string text = msg.Message.Replace("\n", System.Environment.NewLine);
text = text.Remove(0, pos + 1);
- lblTitle.Text = title;
- lblSentBy.Text = string.Format("Sent by {0}, {1}", msg.FromAgentName, group);
+ lblSentBy.Text = string.Format("Sent by {0}", msg.FromAgentName);
txtNotice.Text = text;
+ if (instance.Groups.ContainsKey(groupID))
+ {
+ group = instance.Groups[groupID];
+ ShowNotice();
+ }
+ else
+ {
+ client.Groups.RequestGroupProfile(groupID);
+ }
+
+ }
+
+ private void ShowNotice()
+ {
+ if (group.ID == UUID.Zero) return;
+
+ imgGroup.Init(instance, group.InsigniaID, string.Empty);
+ lblSentBy.Text += ", " + group.Name;
+
// Fire off event
NotificationEventArgs args = new NotificationEventArgs(instance);
args.Text = string.Format("{0}{1}{2}{3}{4}",
@@ -106,6 +122,25 @@ public ntfGroupNotice(RadegastInstance instance, InstantMessage msg)
FireNotificationCallback(args);
}
+ void ntfGroupNotice_Disposed(object sender, System.EventArgs e)
+ {
+ client.Groups.GroupProfile -= new System.EventHandler<GroupProfileEventArgs>(Groups_GroupProfile);
+ }
+
+ void Groups_GroupProfile(object sender, GroupProfileEventArgs e)
+ {
+ if (groupID != e.Group.ID) return;
+
+ if (instance.MainForm.InvokeRequired)
+ {
+ instance.MainForm.BeginInvoke(new MethodInvoker(() => Groups_GroupProfile(sender, e)));
+ return;
+ }
+
+ group = e.Group;
+ ShowNotice();
+ }
+
private void SendReply(InstantMessageDialog dialog, byte[] bucket)
{
client.Self.InstantMessage(client.Self.Name, msg.FromAgentID, string.Empty, msg.IMSessionID, dialog, InstantMessageOnline.Offline, client.Self.SimPosition, client.Network.CurrentSim.RegionID, bucket);
Please sign in to comment.
Something went wrong with that request. Please try again.