29 using System.Collections.Generic;
31 using OpenSim.Framework;
34 namespace OpenSim.Groups
86 n.FromName = this.FromName;
87 n.AssetType = this.AttachmentType;
88 n.HasAttachment = this.HasAttachment;
89 n.NoticeID = this.NoticeID;
90 n.Subject = this.Subject;
91 n.Timestamp = this.Timestamp;
101 return s == null ? string.Empty : s;
106 Dictionary<string, object> dict =
new Dictionary<string, object>();
110 dict[
"AllowPublish"] = grec.AllowPublish.ToString();
111 dict[
"Charter"] = Sanitize(grec.
Charter);
112 dict[
"FounderID"] = grec.FounderID.ToString();
113 dict[
"FounderUUI"] = Sanitize(grec.
FounderUUI);
114 dict[
"GroupID"] = grec.GroupID.ToString();
115 dict[
"GroupName"] = Sanitize(grec.
GroupName);
116 dict[
"InsigniaID"] = grec.GroupPicture.ToString();
117 dict[
"MaturePublish"] = grec.MaturePublish.ToString();
118 dict[
"MembershipFee"] = grec.MembershipFee.ToString();
119 dict[
"OpenEnrollment"] = grec.OpenEnrollment.ToString();
120 dict[
"OwnerRoleID"] = grec.OwnerRoleID.ToString();
122 dict[
"ShownInList"] = grec.ShowInList.ToString();
123 dict[
"MemberCount"] = grec.MemberCount.ToString();
124 dict[
"RoleCount"] = grec.RoleCount.ToString();
135 if (dict.ContainsKey(
"AllowPublish") && dict[
"AllowPublish"] != null)
136 grec.
AllowPublish =
bool.Parse(dict[
"AllowPublish"].ToString());
138 if (dict.ContainsKey(
"Charter") && dict[
"Charter"] != null)
139 grec.
Charter = dict[
"Charter"].ToString();
141 grec.Charter = string.Empty;
143 if (dict.ContainsKey(
"FounderID") && dict[
"FounderID"] != null)
144 grec.
FounderID = UUID.Parse(dict[
"FounderID"].ToString());
146 if (dict.ContainsKey(
"FounderUUI") && dict[
"FounderUUI"] != null)
147 grec.
FounderUUI = dict[
"FounderUUI"].ToString();
149 grec.FounderUUI = string.Empty;
151 if (dict.ContainsKey(
"GroupID") && dict[
"GroupID"] != null)
152 grec.
GroupID = UUID.Parse(dict[
"GroupID"].ToString());
154 if (dict.ContainsKey(
"GroupName") && dict[
"GroupName"] != null)
155 grec.
GroupName = dict[
"GroupName"].ToString();
157 grec.GroupName = string.Empty;
159 if (dict.ContainsKey(
"InsigniaID") && dict[
"InsigniaID"] != null)
160 grec.
GroupPicture = UUID.Parse(dict[
"InsigniaID"].ToString());
162 if (dict.ContainsKey(
"MaturePublish") && dict[
"MaturePublish"] != null)
163 grec.
MaturePublish =
bool.Parse(dict[
"MaturePublish"].ToString());
165 if (dict.ContainsKey(
"MembershipFee") && dict[
"MembershipFee"] != null)
166 grec.
MembershipFee = Int32.Parse(dict[
"MembershipFee"].ToString());
168 if (dict.ContainsKey(
"OpenEnrollment") && dict[
"OpenEnrollment"] != null)
169 grec.
OpenEnrollment =
bool.Parse(dict[
"OpenEnrollment"].ToString());
171 if (dict.ContainsKey(
"OwnerRoleID") && dict[
"OwnerRoleID"] != null)
172 grec.
OwnerRoleID = UUID.Parse(dict[
"OwnerRoleID"].ToString());
174 if (dict.ContainsKey(
"ServiceLocation") && dict[
"ServiceLocation"] != null)
177 grec.ServiceLocation = string.Empty;
179 if (dict.ContainsKey(
"ShownInList") && dict[
"ShownInList"] != null)
180 grec.
ShowInList =
bool.Parse(dict[
"ShownInList"].ToString());
182 if (dict.ContainsKey(
"MemberCount") && dict[
"MemberCount"] != null)
183 grec.
MemberCount = Int32.Parse(dict[
"MemberCount"].ToString());
185 if (dict.ContainsKey(
"RoleCount") && dict[
"RoleCount"] != null)
186 grec.
RoleCount = Int32.Parse(dict[
"RoleCount"].ToString());
193 Dictionary<string, object> dict =
new Dictionary<string, object>();
194 if (membership == null)
197 dict[
"AcceptNotices"] = membership.AcceptNotices.ToString();
198 dict[
"AccessToken"] = Sanitize(membership.
AccessToken);
199 dict[
"Active"] = membership.Active.ToString();
200 dict[
"ActiveRole"] = membership.ActiveRole.ToString();
201 dict[
"AllowPublish"] = membership.AllowPublish.ToString();
202 dict[
"Charter"] = Sanitize(membership.
Charter);
203 dict[
"Contribution"] = membership.Contribution.ToString();
204 dict[
"FounderID"] = membership.FounderID.ToString();
205 dict[
"GroupID"] = membership.GroupID.ToString();
206 dict[
"GroupName"] = Sanitize(membership.
GroupName);
207 dict[
"GroupPicture"] = membership.GroupPicture.ToString();
208 dict[
"GroupPowers"] = membership.GroupPowers.ToString();
209 dict[
"GroupTitle"] = Sanitize(membership.
GroupTitle);
210 dict[
"ListInProfile"] = membership.ListInProfile.ToString();
211 dict[
"MaturePublish"] = membership.MaturePublish.ToString();
212 dict[
"MembershipFee"] = membership.MembershipFee.ToString();
213 dict[
"OpenEnrollment"] = membership.OpenEnrollment.ToString();
214 dict[
"ShowInList"] = membership.ShowInList.ToString();
226 if (dict.ContainsKey(
"AcceptNotices") && dict[
"AcceptNotices"] != null)
227 membership.
AcceptNotices =
bool.Parse(dict[
"AcceptNotices"].ToString());
229 if (dict.ContainsKey(
"AccessToken") && dict[
"AccessToken"] != null)
230 membership.
AccessToken = dict[
"AccessToken"].ToString();
232 membership.AccessToken = string.Empty;
234 if (dict.ContainsKey(
"Active") && dict[
"Active"] != null)
235 membership.
Active =
bool.Parse(dict[
"Active"].ToString());
237 if (dict.ContainsKey(
"ActiveRole") && dict[
"ActiveRole"] != null)
238 membership.
ActiveRole = UUID.Parse(dict[
"ActiveRole"].ToString());
240 if (dict.ContainsKey(
"AllowPublish") && dict[
"AllowPublish"] != null)
241 membership.
AllowPublish =
bool.Parse(dict[
"AllowPublish"].ToString());
243 if (dict.ContainsKey(
"Charter") && dict[
"Charter"] != null)
244 membership.
Charter = dict[
"Charter"].ToString();
246 membership.Charter = string.Empty;
248 if (dict.ContainsKey(
"Contribution") && dict[
"Contribution"] != null)
249 membership.
Contribution = Int32.Parse(dict[
"Contribution"].ToString());
251 if (dict.ContainsKey(
"FounderID") && dict[
"FounderID"] != null)
252 membership.
FounderID = UUID.Parse(dict[
"FounderID"].ToString());
254 if (dict.ContainsKey(
"GroupID") && dict[
"GroupID"] != null)
255 membership.
GroupID = UUID.Parse(dict[
"GroupID"].ToString());
257 if (dict.ContainsKey(
"GroupName") && dict[
"GroupName"] != null)
258 membership.
GroupName = dict[
"GroupName"].ToString();
260 membership.GroupName = string.Empty;
262 if (dict.ContainsKey(
"GroupPicture") && dict[
"GroupPicture"] != null)
263 membership.
GroupPicture = UUID.Parse(dict[
"GroupPicture"].ToString());
265 if (dict.ContainsKey(
"GroupPowers") && dict[
"GroupPowers"] != null)
266 membership.
GroupPowers = UInt64.Parse(dict[
"GroupPowers"].ToString());
268 if (dict.ContainsKey(
"GroupTitle") && dict[
"GroupTitle"] != null)
269 membership.
GroupTitle = dict[
"GroupTitle"].ToString();
271 membership.GroupTitle = string.Empty;
273 if (dict.ContainsKey(
"ListInProfile") && dict[
"ListInProfile"] != null)
274 membership.
ListInProfile =
bool.Parse(dict[
"ListInProfile"].ToString());
276 if (dict.ContainsKey(
"MaturePublish") && dict[
"MaturePublish"] != null)
277 membership.
MaturePublish =
bool.Parse(dict[
"MaturePublish"].ToString());
279 if (dict.ContainsKey(
"MembershipFee") && dict[
"MembershipFee"] != null)
280 membership.
MembershipFee = Int32.Parse(dict[
"MembershipFee"].ToString());
282 if (dict.ContainsKey(
"OpenEnrollment") && dict[
"OpenEnrollment"] != null)
283 membership.
OpenEnrollment =
bool.Parse(dict[
"OpenEnrollment"].ToString());
285 if (dict.ContainsKey(
"ShowInList") && dict[
"ShowInList"] != null)
286 membership.
ShowInList =
bool.Parse(dict[
"ShowInList"].ToString());
293 Dictionary<string, object> dict =
new Dictionary<string, object>();
295 dict[
"AcceptNotices"] = member.AcceptNotices.ToString();
296 dict[
"AccessToken"] = Sanitize(member.
AccessToken);
297 dict[
"AgentID"] = Sanitize(member.
AgentID);
298 dict[
"AgentPowers"] = member.AgentPowers.ToString();
299 dict[
"Contribution"] = member.Contribution.ToString();
300 dict[
"IsOwner"] = member.IsOwner.ToString();
301 dict[
"ListInProfile"] = member.ListInProfile.ToString();
303 dict[
"Title"] = Sanitize(member.
Title);
315 if (dict.ContainsKey(
"AcceptNotices") && dict[
"AcceptNotices"] != null)
316 member.
AcceptNotices =
bool.Parse(dict[
"AcceptNotices"].ToString());
318 if (dict.ContainsKey(
"AccessToken") && dict[
"AccessToken"] != null)
319 member.
AccessToken = Sanitize(dict[
"AccessToken"].ToString());
321 member.AccessToken = string.Empty;
323 if (dict.ContainsKey(
"AgentID") && dict[
"AgentID"] != null)
324 member.
AgentID = Sanitize(dict[
"AgentID"].ToString());
326 member.AgentID = UUID.Zero.ToString();
328 if (dict.ContainsKey(
"AgentPowers") && dict[
"AgentPowers"] != null)
329 member.
AgentPowers = UInt64.Parse(dict[
"AgentPowers"].ToString());
331 if (dict.ContainsKey(
"Contribution") && dict[
"Contribution"] != null)
332 member.
Contribution = Int32.Parse(dict[
"Contribution"].ToString());
334 if (dict.ContainsKey(
"IsOwner") && dict[
"IsOwner"] != null)
335 member.
IsOwner =
bool.Parse(dict[
"IsOwner"].ToString());
337 if (dict.ContainsKey(
"ListInProfile") && dict[
"ListInProfile"] != null)
338 member.
ListInProfile =
bool.Parse(dict[
"ListInProfile"].ToString());
340 if (dict.ContainsKey(
"OnlineStatus") && dict[
"OnlineStatus"] != null)
341 member.
OnlineStatus = Sanitize(dict[
"OnlineStatus"].ToString());
343 member.OnlineStatus = string.Empty;
345 if (dict.ContainsKey(
"Title") && dict[
"Title"] != null)
346 member.
Title = Sanitize(dict[
"Title"].ToString());
348 member.Title = string.Empty;
355 Dictionary<string, object> dict =
new Dictionary<string, object>();
358 dict[
"Members"] = role.Members.ToString();
359 dict[
"Name"] = Sanitize(role.
Name);
360 dict[
"Powers"] = role.Powers.ToString();
361 dict[
"RoleID"] = role.RoleID.ToString();
362 dict[
"Title"] = Sanitize(role.
Title);
374 if (dict.ContainsKey(
"Description") && dict[
"Description"] != null)
375 role.
Description = Sanitize(dict[
"Description"].ToString());
377 role.Description = string.Empty;
379 if (dict.ContainsKey(
"Members") && dict[
"Members"] != null)
380 role.
Members = Int32.Parse(dict[
"Members"].ToString());
382 if (dict.ContainsKey(
"Name") && dict[
"Name"] != null)
383 role.
Name = Sanitize(dict[
"Name"].ToString());
385 role.Name = string.Empty;
387 if (dict.ContainsKey(
"Powers") && dict[
"Powers"] != null)
388 role.
Powers = UInt64.Parse(dict[
"Powers"].ToString());
390 if (dict.ContainsKey(
"Title") && dict[
"Title"] != null)
391 role.
Title = Sanitize(dict[
"Title"].ToString());
393 role.Title = string.Empty;
395 if (dict.ContainsKey(
"RoleID") && dict[
"RoleID"] != null)
396 role.
RoleID = UUID.Parse(dict[
"RoleID"].ToString());
403 Dictionary<string, object> dict =
new Dictionary<string, object>();
405 dict[
"RoleID"] = rmember.RoleID.ToString();
406 dict[
"MemberID"] = rmember.MemberID;
414 if (dict.ContainsKey(
"RoleID") && dict[
"RoleID"] != null)
415 rmember.
RoleID =
new UUID(dict[
"RoleID"].ToString());
417 if (dict.ContainsKey(
"MemberID") && dict[
"MemberID"] != null)
418 rmember.
MemberID = dict[
"MemberID"].ToString();
425 Dictionary<string, object> dict =
new Dictionary<string, object>();
427 dict[
"InviteID"] = invite.InviteID.ToString();
428 dict[
"GroupID"] = invite.GroupID.ToString();
429 dict[
"RoleID"] = invite.RoleID.ToString();
430 dict[
"AgentID"] = invite.AgentID;
442 invite.InviteID =
new UUID(dict[
"InviteID"].ToString());
443 invite.GroupID =
new UUID(dict[
"GroupID"].ToString());
444 invite.RoleID =
new UUID(dict[
"RoleID"].ToString());
445 invite.AgentID = Sanitize(dict[
"AgentID"].ToString());
452 Dictionary<string, object> dict =
new Dictionary<string, object>();
454 dict[
"NoticeID"] = notice.NoticeID.ToString();
455 dict[
"Timestamp"] = notice.Timestamp.ToString();
456 dict[
"FromName"] = Sanitize(notice.
FromName);
457 dict[
"Subject"] = Sanitize(notice.
Subject);
458 dict[
"HasAttachment"] = notice.HasAttachment.ToString();
459 dict[
"AttachmentItemID"] = notice.AttachmentItemID.ToString();
461 dict[
"AttachmentType"] = notice.AttachmentType.ToString();
474 notice.NoticeID =
new UUID(dict[
"NoticeID"].ToString());
475 notice.Timestamp = UInt32.Parse(dict[
"Timestamp"].ToString());
476 notice.FromName = Sanitize(dict[
"FromName"].ToString());
477 notice.Subject = Sanitize(dict[
"Subject"].ToString());
478 notice.HasAttachment = bool.Parse(dict[
"HasAttachment"].ToString());
479 notice.AttachmentItemID =
new UUID(dict[
"AttachmentItemID"].ToString());
480 notice.AttachmentName = dict[
"AttachmentName"].ToString();
481 notice.AttachmentType = byte.Parse(dict[
"AttachmentType"].ToString());
482 notice.AttachmentOwnerID = dict[
"AttachmentOwnerID"].ToString();
491 dict[
"GroupID"] = notice.GroupID.ToString();
492 dict[
"Message"] = Sanitize(notice.
Message);
502 notice.GroupID =
new UUID(dict[
"GroupID"].ToString());
503 notice.Message = Sanitize(dict[
"Message"].ToString());
510 Dictionary<string, object> dict =
new Dictionary<string, object>();
512 dict[
"GroupID"] = g.groupID;
513 dict[
"Name"] = g.groupName;
514 dict[
"NMembers"] = g.members;
515 dict[
"SearchOrder"] = g.searchOrder;
524 g.groupID =
new UUID(dict[
"GroupID"].ToString());
525 g.groupName = dict[
"Name"].ToString();
526 Int32.TryParse(dict[
"NMembers"].ToString(), out g.
members);
527 float.TryParse(dict[
"SearchOrder"].ToString(), out g.
searchOrder);
GroupNoticeData ToGroupNoticeData()
static DirGroupsReplyData DirGroupsReplyData(Dictionary< string, object > dict)
ExtendedGroupNoticeData noticeData
static Dictionary< string, object > GroupNoticeData(ExtendedGroupNoticeData notice)
static Dictionary< string, object > GroupInviteInfo(GroupInviteInfo invite)
static Dictionary< string, object > GroupRecord(ExtendedGroupRecord grec)
static ExtendedGroupMembersData GroupMembersData(Dictionary< string, object > dict)
static GroupInviteInfo GroupInviteInfo(Dictionary< string, object > dict)
static Dictionary< string, object > GroupRolesData(GroupRolesData role)
static ExtendedGroupNoticeData GroupNoticeData(Dictionary< string, object > dict)
static ExtendedGroupMembershipData GroupMembershipData(Dictionary< string, object > dict)
static string Sanitize(string s)
static Dictionary< string, object > GroupMembershipData(ExtendedGroupMembershipData membership)
static Dictionary< string, object > DirGroupsReplyData(DirGroupsReplyData g)
static GroupNoticeInfo GroupNoticeInfo(Dictionary< string, object > dict)
static Dictionary< string, object > GroupNoticeInfo(GroupNoticeInfo notice)
static Dictionary< string, object > GroupRoleMembersData(ExtendedGroupRoleMembersData rmember)
static Dictionary< string, object > GroupMembersData(ExtendedGroupMembersData member)
static ExtendedGroupRecord GroupRecord(Dictionary< string, object > dict)
static ExtendedGroupRoleMembersData GroupRoleMembersData(Dictionary< string, object > dict)
static GroupRolesData GroupRolesData(Dictionary< string, object > dict)