Example #1
0
        public GroupMembersData ConvertGroupMembersData(ExtendedGroupMembersData _m)
        {
            GroupMembersData m = new GroupMembersData();
            m.AcceptNotices = _m.AcceptNotices;
            m.AgentPowers = _m.AgentPowers;
            m.Contribution = _m.Contribution;
            m.IsOwner = _m.IsOwner;
            m.ListInProfile = _m.ListInProfile;
            m.OnlineStatus = _m.OnlineStatus;
            m.Title = _m.Title;

            string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;
            Util.ParseUniversalUserIdentifier(_m.AgentID, out m.AgentID, out url, out first, out last, out tmp);
            if (url != string.Empty)
                m_UserManagement.AddUser(m.AgentID, first, last, url);

            return m;
        }
Example #2
0
        public GroupMembersData ConvertGroupMembersData(ExtendedGroupMembersData _m)
        {
			if (m_log.IsDebugEnabled) {
				m_log.DebugFormat ("{0} called", System.Reflection.MethodBase.GetCurrentMethod ().Name);
			}


            GroupMembersData m = new GroupMembersData();
            m.AcceptNotices = _m.AcceptNotices;
            m.AgentPowers = _m.AgentPowers;
            m.Contribution = _m.Contribution;
            m.IsOwner = _m.IsOwner;
            m.ListInProfile = _m.ListInProfile;
            m.OnlineStatus = _m.OnlineStatus;
            m.Title = _m.Title;

            string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;
            Util.ParseUniversalUserIdentifier(_m.AgentID, out m.AgentID, out url, out first, out last, out tmp);
            if (url != string.Empty)
                m_UserManagement.AddUser(m.AgentID, first, last, url);

            return m;
        }
        public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID)
        {
            Hashtable param = new Hashtable();
            param["GroupID"] = GroupID.ToString();

            Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param);

            List<GroupMembersData> members = new List<GroupMembersData>();

            if (respData.Contains("error"))
            {
                return members;
            }

            foreach (Hashtable membership in respData.Values)
            {
                GroupMembersData data = new GroupMembersData();

                data.AcceptNotices = ((string)membership["AcceptNotices"]) == "1";
                data.AgentID = new UUID((string)membership["AgentID"]);
                data.Contribution = int.Parse((string)membership["Contribution"]);
                data.IsOwner = ((string)membership["IsOwner"]) == "1";
                data.ListInProfile = ((string)membership["ListInProfile"]) == "1";
                data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]);
                data.Title = (string)membership["Title"];

                members.Add(data);
            }

            return members;
        }
        public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID)
        {
            if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]  {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            List<GroupMembersData> members = new List<GroupMembersData>();

            OSDMap GroupInfo;
            string GroupName;
            UUID GroupOwnerRoleID = UUID.Zero;
            if (!SimianGetFirstGenericEntry(GroupID, "Group", out GroupName, out GroupInfo))
            {
                return members;
            }
            GroupOwnerRoleID = GroupInfo["OwnerRoleID"].AsUUID();

            // Locally cache group roles, since we'll be needing this data for each member
            Dictionary<string,OSDMap> GroupRoles;
            SimianGetGenericEntries(GroupID, "GroupRole", out GroupRoles);

            // Locally cache list of group owners
            Dictionary<UUID, OSDMap> GroupOwners;
            SimianGetGenericEntries("GroupRole" + GroupID.ToString(), GroupOwnerRoleID.ToString(), out GroupOwners);


            Dictionary<UUID, OSDMap> GroupMembers;
            if (SimianGetGenericEntries("GroupMember", GroupID.ToString(), out GroupMembers))
            {
                foreach (KeyValuePair<UUID, OSDMap> member in GroupMembers)
                {
                    GroupMembersData data = new GroupMembersData();

                    data.AgentID = member.Key;

                    UUID SelectedRoleID = member.Value["SelectedRoleID"].AsUUID();

                    data.AcceptNotices = member.Value["AcceptNotices"].AsBoolean();
                    data.ListInProfile = member.Value["ListInProfile"].AsBoolean();
                    data.Contribution = member.Value["Contribution"].AsInteger();

                    data.IsOwner = GroupOwners.ContainsKey(member.Key);

                    OSDMap GroupRoleInfo = GroupRoles[SelectedRoleID.ToString()];
                    data.Title = GroupRoleInfo["Title"].AsString();
                    data.AgentPowers = GroupRoleInfo["Powers"].AsULong();

                    members.Add(data);
                }
            }

            return members;

        }
        private OpenSim.Framework.GroupMembersData MapGroupMemberFromResult(Dictionary<string, string> result)
        {
            //SELECT osgroupmembership.AgentID" +
            //" , osgroupmembership.Contribution, osgroupmembership.ListInProfile, osgroupmembership.AcceptNotices" +
            //" , osgroupmembership.SelectedRoleID, osrole.Title
            
            OpenSim.Framework.GroupMembersData membersData = new OpenSim.Framework.GroupMembersData();
            membersData.AgentID = new UUID(result["AgentID"]);
            membersData.Contribution = Int32.Parse(result["Contribution"]);
            membersData.ListInProfile = result["ListInProfile"] == "1";
            membersData.AcceptNotices = result["AcceptNotices"] == "1";
            membersData.Title = result["Title"];
            membersData.IsOwner = result["IsOwner"] == "1";
            membersData.OnlineStatus = result["OnlineStatus"] == "1";
            membersData.LastLogout = UInt32.Parse(result["LastLogout"]);

            return membersData;
        }
        public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID, bool ListOffline)
        {
            Hashtable param = new Hashtable();
            param["GroupID"] = GroupID.ToString();
            param["ListOffline"] = ListOffline.ToString();

            Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param);

            List<GroupMembersData> members = new List<GroupMembersData>();

            if (respData.Contains("error"))
            {
                return members;
            }

            DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0); 

            foreach (Hashtable membership in respData.Values)
            {
                string LastLogin;
                if ((string)membership["Online"] == "1")
                {
                    LastLogin = "******";
                }
                else
                {
                    DateTime Login = origin.AddSeconds(Convert.ToDouble(membership["LastLogin"]));
                    LastLogin = Login.ToShortDateString().ToString();
                }

                GroupMembersData data = new GroupMembersData();

                data.AcceptNotices = ((string)membership["AcceptNotices"]) == "1";
                data.AgentID = new UUID((string)membership["AgentID"]);
                data.Contribution = int.Parse((string)membership["Contribution"]);
                data.IsOwner = ((string)membership["IsOwner"]) == "1";
                data.ListInProfile = ((string)membership["ListInProfile"]) == "1";
                data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]);
                data.Title = (string)membership["Title"];
                data.OnlineStatus = LastLogin;

                members.Add(data);
            }

            return members;

        }
        public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID groupID)
        {
            m_log.DebugFormat(
                "[MOCK GROUPS SERVICES CONNECTOR]: GetGroupMembers, requestingAgentID {0}, groupID {1}",
                requestingAgentID, groupID);

            List<GroupMembersData> groupMembers = new List<GroupMembersData>();

            XGroup group = GetXGroup(groupID, null);

            if (group == null)
                return groupMembers;

            foreach (XGroupMember xgm in group.members.Values)
            {
                GroupMembersData gmd = new GroupMembersData();
                gmd.AgentID = xgm.agentID;
                gmd.IsOwner = group.founderID == gmd.AgentID;
                gmd.AcceptNotices = xgm.acceptNotices;
                gmd.ListInProfile = xgm.listInProfile;

                groupMembers.Add(gmd);
            }

            return groupMembers;
        }