/// <summary>Process an incoming packet and raise the appropriate events</summary> /// <param name="sender">The sender</param> /// <param name="e">The EventArgs object containing the packet data</param> private void ChangeUserRightsHandler(object sender, PacketReceivedEventArgs e) { Packet packet = e.Packet; if (packet.Type == PacketType.ChangeUserRights) { FriendInfo friend; ChangeUserRightsPacket rights = (ChangeUserRightsPacket)packet; foreach (ChangeUserRightsPacket.RightsBlock block in rights.Rights) { FriendRights newRights = (FriendRights)block.RelatedRights; if (FriendList.TryGetValue(block.AgentRelated, out friend)) { friend.TheirFriendRights = newRights; if (m_FriendRights != null) { OnFriendRights(new FriendInfoEventArgs(friend)); } } else if (block.AgentRelated == Client.Self.AgentID) { if (FriendList.TryGetValue(rights.AgentData.AgentID, out friend)) { friend.MyFriendRights = newRights; if (m_FriendRights != null) { OnFriendRights(new FriendInfoEventArgs(friend)); } } } } } }
/// <summary> /// Handle notifications sent when a friend rights change. This notification is also received /// when my own rights change. /// </summary> /// <param name="packet"></param> /// <param name="simulator"></param> private void ChangeUserRightsHandler(Packet packet, Simulator simulator) { if (packet.Type == PacketType.ChangeUserRights) { FriendInfo friend; ChangeUserRightsPacket rights = (ChangeUserRightsPacket)packet; foreach (ChangeUserRightsPacket.RightsBlock block in rights.Rights) { FriendRights newRights = (FriendRights)block.RelatedRights; if (FriendList.TryGetValue(block.AgentRelated, out friend)) { friend.TheirFriendRights = newRights; if (OnFriendRights != null) { try { OnFriendRights(friend); } catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } } } else if (block.AgentRelated == Client.Self.AgentID) { if (FriendList.TryGetValue(rights.AgentData.AgentID, out friend)) { friend.MyFriendRights = newRights; if (OnFriendRights != null) { try { OnFriendRights(friend); } catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } } } } } } }
private Packet UserRights(Packet packet, IPEndPoint sim) { lock (recSeq) { if (!recSeq.Contains(packet.Header.Sequence)) { recSeq.Add(packet.Header.Sequence); if (recSeq.Count > 200) { recSeq.RemoveAt(0); } if (form.getCheckMod()) { ChangeUserRightsPacket cur = (ChangeUserRightsPacket)packet; //if (cur.AgentData.AgentID == lastrights.AgentData.AgentID) return null; lock (lastrights) { lastrights.Add(new rights((ChangeUserRightsPacket)packet)); if (lastrights.Count > 3) { lastrights.RemoveAt(0); } } List <UUID> whos = new List <UUID>(); lock (lastIM) { foreach (rights r in lastrights) { ChangeUserRightsPacket p = r.p; UUID who = p.AgentData.AgentID; if (!whos.Contains(who)) { whos.Add(who); } } } if (whos.Count == 1 && lastrights.Count == 3) { TimeSpan duration = this.lastrights[2].time - lastrights[0].time; if (duration.TotalMilliseconds < 2000) { form.textBox1.Text += "DR"; //proxy.writeinthis("DR", ConsoleColor.Black, ConsoleColor.Red); return(null); } } } } else { return(null); } } return(packet); }
public rights(ChangeUserRightsPacket pp) { p = pp; time = System.DateTime.Now; }
public rights(ChangeUserRightsPacket pp) { p = pp; time =System.DateTime.Now ; }