public void AddUserToChan(Agent agent)
 {
     try
     {
         if(agent.session >= 0)
         {
             User state = m_server.getState(agent.session);
             if (state.channel != agent.channel) {
                 state.channel = agent.channel;
                 m_server.setState(state);
             }
         }
         else
         {
             m_log.DebugFormat("[MurmurVoice] Session not connected yet, deferring move for {0} to {1}.", agent.uuid.ToString(), agent.channel);
         }
     } catch (KeyNotFoundException)
     {
         m_log.DebugFormat("[MurmurVoice] No user with id {0} to move.", agent.userid);
     }
 }
        private Agent Add(UUID uuid)
        {
            Agent agent = new Agent(uuid);

            foreach(var user in m_server.getRegisteredUsers(agent.web))
                {
                if(user.Value == agent.web)
                    {
                    m_log.InfoFormat("[MurmurVoice] Found previously registered user {0} {1}", user.Value,user.Key);
                    agent.userid = user.Key;
                    lock(userid_to_agent)
                        userid_to_agent[agent.userid] = agent;

                    lock(uuid_to_agent)
                        uuid_to_agent[agent.uuid] = agent;

                    foreach(var u in m_server.getUsers())
                        {
                        if(u.Value.userid == agent.userid)
                            {
                            agent.session = u.Value.session;
                            agent.channel = u.Value.channel;
                            m_log.InfoFormat("[MurmurVoice]: Registered user already connected");
                            break;
                            }
                        }
                    return agent;
                    }
                }

            agent.userid = m_server.registerUser(agent.user_info);
            m_log.InfoFormat("[MurmurVoice]: Registered {0} (uid {1}) identified by {2}", agent.uuid.ToString(), agent.userid, agent.pass);

            lock(userid_to_agent)
                userid_to_agent[agent.userid] = agent;

            lock(uuid_to_agent)
                uuid_to_agent[agent.uuid] = agent;

            return agent;
        }
Пример #3
0
        private Agent Add(UUID uuid, Scene scene)
        {
            Agent agent = new Agent(uuid, scene);

            Dictionary<int, User> users = m_server.getUsers();

            foreach (var v in users)
            {
                User user = v.Value;

                if (user.name == agent.name)
                {
                    m_log.DebugFormat("[MurmurVoice] Found previously registered user {0} {1} {2} {3}", user.name, user.userid, user.session, user.channel);

                    if ((user.userid >= 0) && (user.session >= 0))
                    {
                        // Reuse Murmur User
                        m_log.DebugFormat("[MurmurVoice] Reusing previously registered user {0} {1} {2} {3}", user.name, user.userid, user.session, user.channel);

                        agent.userid = user.userid;
                        agent.session = user.session;
                        agent.channel = user.channel;

                        lock (name_to_agent)
                            name_to_agent[agent.name] = agent;

                        // Handle password changes
                        m_server.updateRegistration(agent.userid, agent.user_info);

                        return agent;
                    }
                    else
                    {
                        if (user.userid >= 0)
                        {
                            agent.userid = user.userid;

                            lock (name_to_agent)
                                name_to_agent[agent.name] = agent;

                            // Handle password changes
                            m_server.updateRegistration(agent.userid, agent.user_info);

                            return agent;
                        }
                    }
                    break;
                }
            }

            lock (name_to_agent)
                name_to_agent[agent.name] = agent;

            try
            {
                int r = m_server.registerUser(agent.user_info);
                if (r >= 0) agent.userid = r;
            }
            catch (Murmur.InvalidUserException)
            {
                m_log.Warn("[MurmurVoice] InvalidUserException; continuing to recover later");
            }

            m_log.DebugFormat("[MurmurVoice] Registered {0} (uid {1}) identified by {2}", agent.uuid.ToString(), agent.userid, agent.pass);

            return agent;
        }
Пример #4
0
        /// Callback for a client request for Voice Account Details.
        public string ProvisionVoiceAccountRequest(Scene scene, string request, string path, string param,
                                                   UUID agentID)
        {
            try
            {
                m_log.Debug("[MurmurVoice] Calling ProvisionVoiceAccountRequest...");

                if (scene == null) throw new Exception("[MurmurVoice] Invalid scene.");

                // Wait for scene presence
                int retry = 0;
                ScenePresence avatar = scene.GetScenePresence(agentID);
                while (avatar == null)
                {
                    if (++retry > 100)
                        throw new Exception(String.Format("region \"{0}\": agent ID \"{1}\": wait for scene presence timed out",
                                            scene.RegionInfo.RegionName, agentID));

                    Thread.Sleep(100);
                    avatar = scene.GetScenePresence(agentID);
                }

                Agent agent = new Agent(agentID, scene);

                LLSDVoiceAccountResponse voiceAccountResponse =
                    new LLSDVoiceAccountResponse(agent.name, agent.pass, m_murmurd_host, 
                        String.Format("tcp://{0}:{1}", m_murmurd_host, m_murmurd_port)
                );

                string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
                m_log.DebugFormat("[MurmurVoice] VoiceAccount: {0}", r);
                return r;
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[MurmurVoice] {0} failed", e.ToString());
                return "<llsd><undef /></llsd>";
            }
        }
Пример #5
0
        public void RemoveAgent(UUID uuid)
        {
            Agent user = new Agent(uuid, null);

            m_log.DebugFormat("[MurmurVoice] Removing registered user {0}", user.name);

            lock (name_to_agent)
                if (name_to_agent.ContainsKey(user.name))
                    name_to_agent.Remove(user.name);
        }