* Prevent session crashes when something goes wrong with group invite.
* Thanks mcortez.
trunk
Justin Clarke Casey 2009-07-24 20:08:26 +00:00
parent c3bb9ec42c
commit a7c8948292
1 changed files with 39 additions and 23 deletions

View File

@ -122,7 +122,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
return; return;
} }
m_log.Info("[GROUPS]: Initializing XmlRpcGroups"); m_log.InfoFormat("[GROUPS]: Initializing {0}", this.Name);
string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL", m_defaultXmlRpcServiceURL); string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL", m_defaultXmlRpcServiceURL);
bool DisableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false); bool DisableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false);
@ -138,6 +138,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut; m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut;
m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache; m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache;
m_clientRequestIDFlushTimer.AutoReset = true;
m_clientRequestIDFlushTimer.Start(); m_clientRequestIDFlushTimer.Start();
} }
} }
@ -371,6 +372,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
UUID inviteID = new UUID(im.imSessionID); UUID inviteID = new UUID(im.imSessionID);
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID); GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID);
if (inviteInfo == null)
{
if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Received an Invite IM for an invite that does not exist {0}.", inviteID);
return;
}
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Invite is for Agent {0} to Group {1}.", inviteInfo.AgentID, inviteInfo.GroupID); if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Invite is for Agent {0} to Group {1}.", inviteInfo.AgentID, inviteInfo.GroupID);
UUID fromAgentID = new UUID(im.fromAgentID); UUID fromAgentID = new UUID(im.fromAgentID);
@ -1037,8 +1044,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// Todo: Security check, probably also want to send some kind of notification // Todo: Security check, probably also want to send some kind of notification
UUID InviteID = UUID.Random(); UUID InviteID = UUID.Random();
m_groupData.AddAgentToGroupInvite(GetClientGroupRequestID(remoteClient), InviteID, groupID, roleID, invitedAgentID); GroupRequestID grid = GetClientGroupRequestID(remoteClient);
m_groupData.AddAgentToGroupInvite(grid, InviteID, groupID, roleID, invitedAgentID);
// Check to see if the invite went through, if it did not then it's possible
// the remoteClient did not validate or did not have permission to invite.
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(grid, InviteID);
if (inviteInfo != null)
{
if (m_msgTransferModule != null) if (m_msgTransferModule != null)
{ {
Guid inviteUUID = InviteID.Guid; Guid inviteUUID = InviteID.Guid;
@ -1065,6 +1080,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
OutgoingInstantMessage(msg, invitedAgentID); OutgoingInstantMessage(msg, invitedAgentID);
} }
} }
}
#endregion #endregion