1
0

XmlRpcGroupsServicesConnectorModule.cs 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections;
  29. using System.Collections.Generic;
  30. using System.Reflection;
  31. using System.Text;
  32. using Nwc.XmlRpc;
  33. using log4net;
  34. using Mono.Addins;
  35. using Nini.Config;
  36. using OpenMetaverse;
  37. using OpenMetaverse.StructuredData;
  38. using OpenSim.Framework;
  39. using OpenSim.Framework.Communications;
  40. using OpenSim.Region.Framework.Interfaces;
  41. using OpenSim.Services.Interfaces;
  42. namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
  43. {
  44. [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcGroupsServicesConnectorModule")]
  45. public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector
  46. {
  47. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  48. private bool m_debugEnabled = false;
  49. public const GroupPowers DefaultEveryonePowers
  50. = GroupPowers.AllowSetHome
  51. | GroupPowers.Accountable
  52. | GroupPowers.JoinChat
  53. | GroupPowers.AllowVoiceChat
  54. | GroupPowers.ReceiveNotices
  55. | GroupPowers.StartProposal
  56. | GroupPowers.VoteOnProposal;
  57. // Would this be cleaner as (GroupPowers)ulong.MaxValue?
  58. public const GroupPowers DefaultOwnerPowers
  59. = GroupPowers.Accountable
  60. | GroupPowers.AllowEditLand
  61. | GroupPowers.AllowFly
  62. | GroupPowers.AllowLandmark
  63. | GroupPowers.AllowRez
  64. | GroupPowers.AllowSetHome
  65. | GroupPowers.AllowVoiceChat
  66. | GroupPowers.AssignMember
  67. | GroupPowers.AssignMemberLimited
  68. | GroupPowers.ChangeActions
  69. | GroupPowers.ChangeIdentity
  70. | GroupPowers.ChangeMedia
  71. | GroupPowers.ChangeOptions
  72. | GroupPowers.CreateRole
  73. | GroupPowers.DeedObject
  74. | GroupPowers.DeleteRole
  75. | GroupPowers.Eject
  76. | GroupPowers.FindPlaces
  77. | GroupPowers.Invite
  78. | GroupPowers.JoinChat
  79. | GroupPowers.LandChangeIdentity
  80. | GroupPowers.LandDeed
  81. | GroupPowers.LandDivideJoin
  82. | GroupPowers.LandEdit
  83. | GroupPowers.LandEjectAndFreeze
  84. | GroupPowers.LandGardening
  85. | GroupPowers.LandManageAllowed
  86. | GroupPowers.LandManageBanned
  87. | GroupPowers.LandManagePasses
  88. | GroupPowers.LandOptions
  89. | GroupPowers.LandRelease
  90. | GroupPowers.LandSetSale
  91. | GroupPowers.ModerateChat
  92. | GroupPowers.ObjectManipulate
  93. | GroupPowers.ObjectSetForSale
  94. | GroupPowers.ReceiveNotices
  95. | GroupPowers.RemoveMember
  96. | GroupPowers.ReturnGroupOwned
  97. | GroupPowers.ReturnGroupSet
  98. | GroupPowers.ReturnNonGroup
  99. | GroupPowers.RoleProperties
  100. | GroupPowers.SendNotices
  101. | GroupPowers.SetLandingPoint
  102. | GroupPowers.StartProposal
  103. | GroupPowers.VoteOnProposal;
  104. private bool m_connectorEnabled = false;
  105. private string m_groupsServerURI = string.Empty;
  106. private bool m_disableKeepAlive = false;
  107. private string m_groupReadKey = string.Empty;
  108. private string m_groupWriteKey = string.Empty;
  109. private IUserAccountService m_accountService = null;
  110. private ExpiringCache<string, XmlRpcResponse> m_memoryCache;
  111. private int m_cacheTimeout = 30;
  112. // Used to track which agents are have dropped from a group chat session
  113. // Should be reset per agent, on logon
  114. // TODO: move this to Flotsam XmlRpc Service
  115. // SessionID, List<AgentID>
  116. private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>();
  117. private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>();
  118. #region Region Module interfaceBase Members
  119. public string Name
  120. {
  121. get { return "XmlRpcGroupsServicesConnector"; }
  122. }
  123. // this module is not intended to be replaced, but there should only be 1 of them.
  124. public Type ReplaceableInterface
  125. {
  126. get { return null; }
  127. }
  128. public void Initialise(IConfigSource config)
  129. {
  130. IConfig groupsConfig = config.Configs["Groups"];
  131. if (groupsConfig == null)
  132. {
  133. // Do not run this module by default.
  134. return;
  135. }
  136. else
  137. {
  138. // if groups aren't enabled, we're not needed.
  139. // if we're not specified as the connector to use, then we're not wanted
  140. if ((groupsConfig.GetBoolean("Enabled", false) == false)
  141. || (groupsConfig.GetString("ServicesConnectorModule", "XmlRpcGroupsServicesConnector") != Name))
  142. {
  143. m_connectorEnabled = false;
  144. return;
  145. }
  146. m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Initializing {0}", this.Name);
  147. m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty);
  148. if ((m_groupsServerURI == null) ||
  149. (m_groupsServerURI == string.Empty))
  150. {
  151. m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]");
  152. m_connectorEnabled = false;
  153. return;
  154. }
  155. m_disableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false);
  156. m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty);
  157. m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty);
  158. m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30);
  159. if (m_cacheTimeout == 0)
  160. {
  161. m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled.");
  162. }
  163. else
  164. {
  165. m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.", m_cacheTimeout);
  166. }
  167. m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false);
  168. // If we got all the config options we need, lets start'er'up
  169. m_memoryCache = new ExpiringCache<string, XmlRpcResponse>();
  170. m_connectorEnabled = true;
  171. }
  172. }
  173. public void Close()
  174. {
  175. m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Closing {0}", this.Name);
  176. }
  177. public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene)
  178. {
  179. if (m_connectorEnabled)
  180. {
  181. if (m_accountService == null)
  182. {
  183. m_accountService = scene.UserAccountService;
  184. }
  185. scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
  186. }
  187. }
  188. public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene)
  189. {
  190. if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this)
  191. {
  192. scene.UnregisterModuleInterface<IGroupsServicesConnector>(this);
  193. }
  194. }
  195. public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene)
  196. {
  197. // TODO: May want to consider listenning for Agent Connections so we can pre-cache group info
  198. // scene.EventManager.OnNewClient += OnNewClient;
  199. }
  200. #endregion
  201. #region ISharedRegionModule Members
  202. public void PostInitialise()
  203. {
  204. // NoOp
  205. }
  206. #endregion
  207. #region IGroupsServicesConnector Members
  208. /// <summary>
  209. /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role.
  210. /// </summary>
  211. public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID,
  212. int membershipFee, bool openEnrollment, bool allowPublish,
  213. bool maturePublish, UUID founderID)
  214. {
  215. UUID GroupID = UUID.Random();
  216. UUID OwnerRoleID = UUID.Random();
  217. Hashtable param = new Hashtable();
  218. param["GroupID"] = GroupID.ToString();
  219. param["Name"] = name;
  220. param["Charter"] = charter;
  221. param["ShowInList"] = showInList == true ? 1 : 0;
  222. param["InsigniaID"] = insigniaID.ToString();
  223. param["MembershipFee"] = membershipFee;
  224. param["OpenEnrollment"] = openEnrollment == true ? 1 : 0;
  225. param["AllowPublish"] = allowPublish == true ? 1 : 0;
  226. param["MaturePublish"] = maturePublish == true ? 1 : 0;
  227. param["FounderID"] = founderID.ToString();
  228. param["EveryonePowers"] = ((ulong)DefaultEveryonePowers).ToString();
  229. param["OwnerRoleID"] = OwnerRoleID.ToString();
  230. param["OwnersPowers"] = ((ulong)DefaultOwnerPowers).ToString();
  231. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param);
  232. if (respData.Contains("error"))
  233. {
  234. // UUID is not nullable
  235. return UUID.Zero;
  236. }
  237. return UUID.Parse((string)respData["GroupID"]);
  238. }
  239. public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList,
  240. UUID insigniaID, int membershipFee, bool openEnrollment,
  241. bool allowPublish, bool maturePublish)
  242. {
  243. Hashtable param = new Hashtable();
  244. param["GroupID"] = groupID.ToString();
  245. param["Charter"] = charter;
  246. param["ShowInList"] = showInList == true ? 1 : 0;
  247. param["InsigniaID"] = insigniaID.ToString();
  248. param["MembershipFee"] = membershipFee;
  249. param["OpenEnrollment"] = openEnrollment == true ? 1 : 0;
  250. param["AllowPublish"] = allowPublish == true ? 1 : 0;
  251. param["MaturePublish"] = maturePublish == true ? 1 : 0;
  252. XmlRpcCall(requestingAgentID, "groups.updateGroup", param);
  253. }
  254. public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
  255. string title, ulong powers)
  256. {
  257. Hashtable param = new Hashtable();
  258. param["GroupID"] = groupID.ToString();
  259. param["RoleID"] = roleID.ToString();
  260. param["Name"] = name;
  261. param["Description"] = description;
  262. param["Title"] = title;
  263. param["Powers"] = powers.ToString();
  264. XmlRpcCall(requestingAgentID, "groups.addRoleToGroup", param);
  265. }
  266. public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID)
  267. {
  268. Hashtable param = new Hashtable();
  269. param["GroupID"] = groupID.ToString();
  270. param["RoleID"] = roleID.ToString();
  271. XmlRpcCall(requestingAgentID, "groups.removeRoleFromGroup", param);
  272. }
  273. public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
  274. string title, ulong powers)
  275. {
  276. Hashtable param = new Hashtable();
  277. param["GroupID"] = groupID.ToString();
  278. param["RoleID"] = roleID.ToString();
  279. if (name != null)
  280. {
  281. param["Name"] = name;
  282. }
  283. if (description != null)
  284. {
  285. param["Description"] = description;
  286. }
  287. if (title != null)
  288. {
  289. param["Title"] = title;
  290. }
  291. param["Powers"] = powers.ToString();
  292. XmlRpcCall(requestingAgentID, "groups.updateGroupRole", param);
  293. }
  294. public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName)
  295. {
  296. Hashtable param = new Hashtable();
  297. if (GroupID != UUID.Zero)
  298. {
  299. param["GroupID"] = GroupID.ToString();
  300. }
  301. if ((GroupName != null) && (GroupName != string.Empty))
  302. {
  303. param["Name"] = GroupName.ToString();
  304. }
  305. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param);
  306. if (respData.Contains("error"))
  307. {
  308. return null;
  309. }
  310. return GroupProfileHashtableToGroupRecord(respData);
  311. }
  312. public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID)
  313. {
  314. Hashtable param = new Hashtable();
  315. param["GroupID"] = GroupID.ToString();
  316. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param);
  317. if (respData.Contains("error"))
  318. {
  319. // GroupProfileData is not nullable
  320. return new GroupProfileData();
  321. }
  322. GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID);
  323. GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData);
  324. MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle;
  325. MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
  326. return MemberGroupProfile;
  327. }
  328. public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
  329. {
  330. Hashtable param = new Hashtable();
  331. param["AgentID"] = AgentID.ToString();
  332. param["GroupID"] = GroupID.ToString();
  333. XmlRpcCall(requestingAgentID, "groups.setAgentActiveGroup", param);
  334. }
  335. public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
  336. {
  337. Hashtable param = new Hashtable();
  338. param["AgentID"] = AgentID.ToString();
  339. param["GroupID"] = GroupID.ToString();
  340. param["SelectedRoleID"] = RoleID.ToString();
  341. XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param);
  342. }
  343. public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile)
  344. {
  345. Hashtable param = new Hashtable();
  346. param["AgentID"] = AgentID.ToString();
  347. param["GroupID"] = GroupID.ToString();
  348. param["AcceptNotices"] = AcceptNotices ? "1" : "0";
  349. param["ListInProfile"] = ListInProfile ? "1" : "0";
  350. XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param);
  351. }
  352. public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID)
  353. {
  354. Hashtable param = new Hashtable();
  355. param["InviteID"] = inviteID.ToString();
  356. param["AgentID"] = agentID.ToString();
  357. param["RoleID"] = roleID.ToString();
  358. param["GroupID"] = groupID.ToString();
  359. XmlRpcCall(requestingAgentID, "groups.addAgentToGroupInvite", param);
  360. }
  361. public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
  362. {
  363. Hashtable param = new Hashtable();
  364. param["InviteID"] = inviteID.ToString();
  365. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentToGroupInvite", param);
  366. if (respData.Contains("error"))
  367. {
  368. return null;
  369. }
  370. GroupInviteInfo inviteInfo = new GroupInviteInfo();
  371. inviteInfo.InviteID = inviteID;
  372. inviteInfo.GroupID = UUID.Parse((string)respData["GroupID"]);
  373. inviteInfo.RoleID = UUID.Parse((string)respData["RoleID"]);
  374. inviteInfo.AgentID = UUID.Parse((string)respData["AgentID"]);
  375. return inviteInfo;
  376. }
  377. public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
  378. {
  379. Hashtable param = new Hashtable();
  380. param["InviteID"] = inviteID.ToString();
  381. XmlRpcCall(requestingAgentID, "groups.removeAgentToGroupInvite", param);
  382. }
  383. public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
  384. {
  385. Hashtable param = new Hashtable();
  386. param["AgentID"] = AgentID.ToString();
  387. param["GroupID"] = GroupID.ToString();
  388. param["RoleID"] = RoleID.ToString();
  389. XmlRpcCall(requestingAgentID, "groups.addAgentToGroup", param);
  390. }
  391. public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
  392. {
  393. Hashtable param = new Hashtable();
  394. param["AgentID"] = AgentID.ToString();
  395. param["GroupID"] = GroupID.ToString();
  396. XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroup", param);
  397. }
  398. public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
  399. {
  400. Hashtable param = new Hashtable();
  401. param["AgentID"] = AgentID.ToString();
  402. param["GroupID"] = GroupID.ToString();
  403. param["RoleID"] = RoleID.ToString();
  404. XmlRpcCall(requestingAgentID, "groups.addAgentToGroupRole", param);
  405. }
  406. public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
  407. {
  408. Hashtable param = new Hashtable();
  409. param["AgentID"] = AgentID.ToString();
  410. param["GroupID"] = GroupID.ToString();
  411. param["RoleID"] = RoleID.ToString();
  412. XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroupRole", param);
  413. }
  414. public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search)
  415. {
  416. Hashtable param = new Hashtable();
  417. param["Search"] = search;
  418. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.findGroups", param);
  419. List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>();
  420. if (!respData.Contains("error"))
  421. {
  422. Hashtable results = (Hashtable)respData["results"];
  423. foreach (Hashtable groupFind in results.Values)
  424. {
  425. DirGroupsReplyData data = new DirGroupsReplyData();
  426. data.groupID = new UUID((string)groupFind["GroupID"]); ;
  427. data.groupName = (string)groupFind["Name"];
  428. data.members = int.Parse((string)groupFind["Members"]);
  429. // data.searchOrder = order;
  430. findings.Add(data);
  431. }
  432. }
  433. return findings;
  434. }
  435. public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID)
  436. {
  437. Hashtable param = new Hashtable();
  438. param["AgentID"] = AgentID.ToString();
  439. param["GroupID"] = GroupID.ToString();
  440. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMembership", param);
  441. if (respData.Contains("error"))
  442. {
  443. return null;
  444. }
  445. GroupMembershipData data = HashTableToGroupMembershipData(respData);
  446. return data;
  447. }
  448. public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID)
  449. {
  450. Hashtable param = new Hashtable();
  451. param["AgentID"] = AgentID.ToString();
  452. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentActiveMembership", param);
  453. if (respData.Contains("error"))
  454. {
  455. return null;
  456. }
  457. return HashTableToGroupMembershipData(respData);
  458. }
  459. public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID)
  460. {
  461. Hashtable param = new Hashtable();
  462. param["AgentID"] = AgentID.ToString();
  463. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMemberships", param);
  464. List<GroupMembershipData> memberships = new List<GroupMembershipData>();
  465. if (!respData.Contains("error"))
  466. {
  467. foreach (object membership in respData.Values)
  468. {
  469. memberships.Add(HashTableToGroupMembershipData((Hashtable)membership));
  470. }
  471. }
  472. return memberships;
  473. }
  474. public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID)
  475. {
  476. Hashtable param = new Hashtable();
  477. param["AgentID"] = AgentID.ToString();
  478. param["GroupID"] = GroupID.ToString();
  479. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentRoles", param);
  480. List<GroupRolesData> Roles = new List<GroupRolesData>();
  481. if (respData.Contains("error"))
  482. {
  483. return Roles;
  484. }
  485. foreach (Hashtable role in respData.Values)
  486. {
  487. GroupRolesData data = new GroupRolesData();
  488. data.RoleID = new UUID((string)role["RoleID"]);
  489. data.Name = (string)role["Name"];
  490. data.Description = (string)role["Description"];
  491. data.Powers = ulong.Parse((string)role["Powers"]);
  492. data.Title = (string)role["Title"];
  493. Roles.Add(data);
  494. }
  495. return Roles;
  496. }
  497. public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID)
  498. {
  499. Hashtable param = new Hashtable();
  500. param["GroupID"] = GroupID.ToString();
  501. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoles", param);
  502. List<GroupRolesData> Roles = new List<GroupRolesData>();
  503. if (respData.Contains("error"))
  504. {
  505. return Roles;
  506. }
  507. foreach (Hashtable role in respData.Values)
  508. {
  509. GroupRolesData data = new GroupRolesData();
  510. data.Description = (string)role["Description"];
  511. data.Members = int.Parse((string)role["Members"]);
  512. data.Name = (string)role["Name"];
  513. data.Powers = ulong.Parse((string)role["Powers"]);
  514. data.RoleID = new UUID((string)role["RoleID"]);
  515. data.Title = (string)role["Title"];
  516. Roles.Add(data);
  517. }
  518. return Roles;
  519. }
  520. public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID)
  521. {
  522. Hashtable param = new Hashtable();
  523. param["GroupID"] = GroupID.ToString();
  524. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param);
  525. List<GroupMembersData> members = new List<GroupMembersData>();
  526. if (respData.Contains("error"))
  527. {
  528. return members;
  529. }
  530. foreach (Hashtable membership in respData.Values)
  531. {
  532. GroupMembersData data = new GroupMembersData();
  533. data.AcceptNotices = ((string)membership["AcceptNotices"]) == "1";
  534. data.AgentID = new UUID((string)membership["AgentID"]);
  535. data.Contribution = int.Parse((string)membership["Contribution"]);
  536. data.IsOwner = ((string)membership["IsOwner"]) == "1";
  537. data.ListInProfile = ((string)membership["ListInProfile"]) == "1";
  538. data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]);
  539. data.Title = (string)membership["Title"];
  540. members.Add(data);
  541. }
  542. return members;
  543. }
  544. public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
  545. {
  546. Hashtable param = new Hashtable();
  547. param["GroupID"] = GroupID.ToString();
  548. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoleMembers", param);
  549. List<GroupRoleMembersData> members = new List<GroupRoleMembersData>();
  550. if (!respData.Contains("error"))
  551. {
  552. foreach (Hashtable membership in respData.Values)
  553. {
  554. GroupRoleMembersData data = new GroupRoleMembersData();
  555. data.MemberID = new UUID((string)membership["AgentID"]);
  556. data.RoleID = new UUID((string)membership["RoleID"]);
  557. members.Add(data);
  558. }
  559. }
  560. return members;
  561. }
  562. public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID)
  563. {
  564. Hashtable param = new Hashtable();
  565. param["GroupID"] = GroupID.ToString();
  566. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotices", param);
  567. List<GroupNoticeData> values = new List<GroupNoticeData>();
  568. if (!respData.Contains("error"))
  569. {
  570. foreach (Hashtable value in respData.Values)
  571. {
  572. GroupNoticeData data = new GroupNoticeData();
  573. data.NoticeID = UUID.Parse((string)value["NoticeID"]);
  574. data.Timestamp = uint.Parse((string)value["Timestamp"]);
  575. data.FromName = (string)value["FromName"];
  576. data.Subject = (string)value["Subject"];
  577. data.HasAttachment = false;
  578. data.AssetType = 0;
  579. values.Add(data);
  580. }
  581. }
  582. return values;
  583. }
  584. public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
  585. {
  586. Hashtable param = new Hashtable();
  587. param["NoticeID"] = noticeID.ToString();
  588. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param);
  589. if (respData.Contains("error"))
  590. {
  591. return null;
  592. }
  593. GroupNoticeInfo data = new GroupNoticeInfo();
  594. data.GroupID = UUID.Parse((string)respData["GroupID"]);
  595. data.Message = (string)respData["Message"];
  596. data.BinaryBucket = Utils.HexStringToBytes((string)respData["BinaryBucket"], true);
  597. data.noticeData.NoticeID = UUID.Parse((string)respData["NoticeID"]);
  598. data.noticeData.Timestamp = uint.Parse((string)respData["Timestamp"]);
  599. data.noticeData.FromName = (string)respData["FromName"];
  600. data.noticeData.Subject = (string)respData["Subject"];
  601. data.noticeData.HasAttachment = false;
  602. data.noticeData.AssetType = 0;
  603. if (data.Message == null)
  604. {
  605. data.Message = string.Empty;
  606. }
  607. return data;
  608. }
  609. public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
  610. {
  611. string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, "");
  612. Hashtable param = new Hashtable();
  613. param["GroupID"] = groupID.ToString();
  614. param["NoticeID"] = noticeID.ToString();
  615. param["FromName"] = fromName;
  616. param["Subject"] = subject;
  617. param["Message"] = message;
  618. param["BinaryBucket"] = binBucket;
  619. param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString();
  620. XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param);
  621. }
  622. #endregion
  623. #region GroupSessionTracking
  624. public void ResetAgentGroupChatSessions(UUID agentID)
  625. {
  626. foreach (List<UUID> agentList in m_groupsAgentsDroppedFromChatSession.Values)
  627. {
  628. agentList.Remove(agentID);
  629. }
  630. }
  631. public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID)
  632. {
  633. // If we're tracking this group, and we can find them in the tracking, then they've been invited
  634. return m_groupsAgentsInvitedToChatSession.ContainsKey(groupID)
  635. && m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID);
  636. }
  637. public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID)
  638. {
  639. // If we're tracking drops for this group,
  640. // and we find them, well... then they've dropped
  641. return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)
  642. && m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID);
  643. }
  644. public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID)
  645. {
  646. if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
  647. {
  648. // If not in dropped list, add
  649. if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
  650. {
  651. m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID);
  652. }
  653. }
  654. }
  655. public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID)
  656. {
  657. // Add Session Status if it doesn't exist for this session
  658. CreateGroupChatSessionTracking(groupID);
  659. // If nessesary, remove from dropped list
  660. if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
  661. {
  662. m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID);
  663. }
  664. }
  665. private void CreateGroupChatSessionTracking(UUID groupID)
  666. {
  667. if (!m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
  668. {
  669. m_groupsAgentsDroppedFromChatSession.Add(groupID, new List<UUID>());
  670. m_groupsAgentsInvitedToChatSession.Add(groupID, new List<UUID>());
  671. }
  672. }
  673. #endregion
  674. #region XmlRpcHashtableMarshalling
  675. private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
  676. {
  677. GroupProfileData group = new GroupProfileData();
  678. group.GroupID = UUID.Parse((string)groupProfile["GroupID"]);
  679. group.Name = (string)groupProfile["Name"];
  680. if (groupProfile["Charter"] != null)
  681. {
  682. group.Charter = (string)groupProfile["Charter"];
  683. }
  684. group.ShowInList = ((string)groupProfile["ShowInList"]) == "1";
  685. group.InsigniaID = UUID.Parse((string)groupProfile["InsigniaID"]);
  686. group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]);
  687. group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1";
  688. group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1";
  689. group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1";
  690. group.FounderID = UUID.Parse((string)groupProfile["FounderID"]);
  691. group.OwnerRole = UUID.Parse((string)groupProfile["OwnerRoleID"]);
  692. group.GroupMembershipCount = int.Parse((string)groupProfile["GroupMembershipCount"]);
  693. group.GroupRolesCount = int.Parse((string)groupProfile["GroupRolesCount"]);
  694. return group;
  695. }
  696. private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile)
  697. {
  698. GroupRecord group = new GroupRecord();
  699. group.GroupID = UUID.Parse((string)groupProfile["GroupID"]);
  700. group.GroupName = groupProfile["Name"].ToString();
  701. if (groupProfile["Charter"] != null)
  702. {
  703. group.Charter = (string)groupProfile["Charter"];
  704. }
  705. group.ShowInList = ((string)groupProfile["ShowInList"]) == "1";
  706. group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]);
  707. group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]);
  708. group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1";
  709. group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1";
  710. group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1";
  711. group.FounderID = UUID.Parse((string)groupProfile["FounderID"]);
  712. group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]);
  713. return group;
  714. }
  715. private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData)
  716. {
  717. GroupMembershipData data = new GroupMembershipData();
  718. data.AcceptNotices = ((string)respData["AcceptNotices"] == "1");
  719. data.Contribution = int.Parse((string)respData["Contribution"]);
  720. data.ListInProfile = ((string)respData["ListInProfile"] == "1");
  721. data.ActiveRole = new UUID((string)respData["SelectedRoleID"]);
  722. data.GroupTitle = (string)respData["Title"];
  723. data.GroupPowers = ulong.Parse((string)respData["GroupPowers"]);
  724. // Is this group the agent's active group
  725. data.GroupID = new UUID((string)respData["GroupID"]);
  726. UUID ActiveGroup = new UUID((string)respData["ActiveGroupID"]);
  727. data.Active = data.GroupID.Equals(ActiveGroup);
  728. data.AllowPublish = ((string)respData["AllowPublish"] == "1");
  729. if (respData["Charter"] != null)
  730. {
  731. data.Charter = (string)respData["Charter"];
  732. }
  733. data.FounderID = new UUID((string)respData["FounderID"]);
  734. data.GroupID = new UUID((string)respData["GroupID"]);
  735. data.GroupName = (string)respData["GroupName"];
  736. data.GroupPicture = new UUID((string)respData["InsigniaID"]);
  737. data.MaturePublish = ((string)respData["MaturePublish"] == "1");
  738. data.MembershipFee = int.Parse((string)respData["MembershipFee"]);
  739. data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1");
  740. data.ShowInList = ((string)respData["ShowInList"] == "1");
  741. return data;
  742. }
  743. #endregion
  744. /// <summary>
  745. /// Encapsulate the XmlRpc call to standardize security and error handling.
  746. /// </summary>
  747. private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param)
  748. {
  749. XmlRpcResponse resp = null;
  750. string CacheKey = null;
  751. // Only bother with the cache if it isn't disabled.
  752. if (m_cacheTimeout > 0)
  753. {
  754. if (!function.StartsWith("groups.get"))
  755. {
  756. // Any and all updates cause the cache to clear
  757. m_memoryCache.Clear();
  758. }
  759. else
  760. {
  761. StringBuilder sb = new StringBuilder(requestingAgentID + function);
  762. foreach (object key in param.Keys)
  763. {
  764. if (param[key] != null)
  765. {
  766. sb.AppendFormat(",{0}:{1}", key.ToString(), param[key].ToString());
  767. }
  768. }
  769. CacheKey = sb.ToString();
  770. m_memoryCache.TryGetValue(CacheKey, out resp);
  771. }
  772. }
  773. if (resp == null)
  774. {
  775. if (m_debugEnabled)
  776. m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Cache miss for key {0}", CacheKey);
  777. string UserService;
  778. UUID SessionID;
  779. GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
  780. param.Add("RequestingAgentID", requestingAgentID.ToString());
  781. param.Add("RequestingAgentUserService", UserService);
  782. param.Add("RequestingSessionID", SessionID.ToString());
  783. param.Add("ReadKey", m_groupReadKey);
  784. param.Add("WriteKey", m_groupWriteKey);
  785. IList parameters = new ArrayList();
  786. parameters.Add(param);
  787. ConfigurableKeepAliveXmlRpcRequest req;
  788. req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
  789. try
  790. {
  791. resp = req.Send(m_groupsServerURI, 10000);
  792. if ((m_cacheTimeout > 0) && (CacheKey != null))
  793. {
  794. m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
  795. }
  796. }
  797. catch (Exception e)
  798. {
  799. m_log.ErrorFormat(
  800. "[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method {0} at {1}",
  801. function, m_groupsServerURI);
  802. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}{1}", e.Message, e.StackTrace);
  803. foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
  804. {
  805. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", ResponseLine);
  806. }
  807. foreach (string key in param.Keys)
  808. {
  809. m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", key, param[key].ToString());
  810. }
  811. Hashtable respData = new Hashtable();
  812. respData.Add("error", e.ToString());
  813. return respData;
  814. }
  815. }
  816. if (resp.Value is Hashtable)
  817. {
  818. Hashtable respData = (Hashtable)resp.Value;
  819. if (respData.Contains("error") && !respData.Contains("succeed"))
  820. {
  821. LogRespDataToConsoleError(respData);
  822. }
  823. return respData;
  824. }
  825. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString());
  826. if (resp.Value is ArrayList)
  827. {
  828. ArrayList al = (ArrayList)resp.Value;
  829. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Contains {0} elements", al.Count);
  830. foreach (object o in al)
  831. {
  832. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", o.GetType().ToString(), o.ToString());
  833. }
  834. }
  835. else
  836. {
  837. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Function returned: {0}", resp.Value.ToString());
  838. }
  839. Hashtable error = new Hashtable();
  840. error.Add("error", "invalid return value");
  841. return error;
  842. }
  843. private void LogRespDataToConsoleError(Hashtable respData)
  844. {
  845. m_log.Error("[XMLRPC-GROUPS-CONNECTOR]: Error:");
  846. foreach (string key in respData.Keys)
  847. {
  848. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Key: {0}", key);
  849. string[] lines = respData[key].ToString().Split(new char[] { '\n' });
  850. foreach (string line in lines)
  851. {
  852. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line);
  853. }
  854. }
  855. }
  856. /// <summary>
  857. /// Group Request Tokens are an attempt to allow the groups service to authenticate
  858. /// requests.
  859. /// TODO: This broke after the big grid refactor, either find a better way, or discard this
  860. /// </summary>
  861. /// <param name="client"></param>
  862. /// <returns></returns>
  863. private void GetClientGroupRequestID(UUID AgentID, out string UserServiceURL, out UUID SessionID)
  864. {
  865. UserServiceURL = "";
  866. SessionID = UUID.Zero;
  867. // Need to rework this based on changes to User Services
  868. /*
  869. UserAccount userAccount = m_accountService.GetUserAccount(UUID.Zero,AgentID);
  870. if (userAccount == null)
  871. {
  872. // This should be impossible. If I've been passed a reference to a client
  873. // that client should be registered with the UserService. So something
  874. // is horribly wrong somewhere.
  875. m_log.WarnFormat("[GROUPS]: Could not find a UserServiceURL for {0}", AgentID);
  876. }
  877. else if (userProfile is ForeignUserProfileData)
  878. {
  879. // They aren't from around here
  880. ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile;
  881. UserServiceURL = fupd.UserServerURI;
  882. SessionID = fupd.CurrentAgent.SessionID;
  883. }
  884. else
  885. {
  886. // They're a local user, use this:
  887. UserServiceURL = m_commManager.NetworkServersInfo.UserURL;
  888. SessionID = userProfile.CurrentAgent.SessionID;
  889. }
  890. */
  891. }
  892. }
  893. }
  894. namespace Nwc.XmlRpc
  895. {
  896. using System;
  897. using System.Collections;
  898. using System.IO;
  899. using System.Xml;
  900. using System.Net;
  901. using System.Text;
  902. using System.Reflection;
  903. /// <summary>Class supporting the request side of an XML-RPC transaction.</summary>
  904. public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest
  905. {
  906. private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer();
  907. private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer();
  908. private bool _disableKeepAlive = true;
  909. public string RequestResponse = String.Empty;
  910. /// <summary>Instantiate an <c>XmlRpcRequest</c> for a specified method and parameters.</summary>
  911. /// <param name="methodName"><c>String</c> designating the <i>object.method</i> on the server the request
  912. /// should be directed to.</param>
  913. /// <param name="parameters"><c>ArrayList</c> of XML-RPC type parameters to invoke the request with.</param>
  914. public ConfigurableKeepAliveXmlRpcRequest(String methodName, IList parameters, bool disableKeepAlive)
  915. {
  916. MethodName = methodName;
  917. _params = parameters;
  918. _disableKeepAlive = disableKeepAlive;
  919. }
  920. /// <summary>Send the request to the server.</summary>
  921. /// <param name="url"><c>String</c> The url of the XML-RPC server.</param>
  922. /// <returns><c>XmlRpcResponse</c> The response generated.</returns>
  923. public XmlRpcResponse Send(String url)
  924. {
  925. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  926. if (request == null)
  927. throw new XmlRpcException(XmlRpcErrorCodes.TRANSPORT_ERROR,
  928. XmlRpcErrorCodes.TRANSPORT_ERROR_MSG + ": Could not create request with " + url);
  929. request.Method = "POST";
  930. request.ContentType = "text/xml";
  931. request.AllowWriteStreamBuffering = true;
  932. request.KeepAlive = !_disableKeepAlive;
  933. using (Stream stream = request.GetRequestStream())
  934. {
  935. using (XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII))
  936. {
  937. _serializer.Serialize(xml, this);
  938. xml.Flush();
  939. }
  940. }
  941. XmlRpcResponse resp;
  942. using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
  943. {
  944. using (Stream s = response.GetResponseStream())
  945. {
  946. using (StreamReader input = new StreamReader(s))
  947. {
  948. string inputXml = input.ReadToEnd();
  949. try
  950. {
  951. resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml);
  952. }
  953. catch (Exception e)
  954. {
  955. RequestResponse = inputXml;
  956. throw e;
  957. }
  958. }
  959. }
  960. }
  961. return resp;
  962. }
  963. }
  964. }