aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/JId.cs
blob: 790a9e0fa0195030158a8da278e6bd7b4350604d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Text;

namespace OpenSim.Framework
{
    public class JId
    {
        public string ServerIP = String.Empty;
        public int ServerPort = 0;
        public string username = String.Empty;
        public string resource = String.Empty;

        public JId()
        {

        }
        public JId(string sJId)
        {
            // user@address:port/resource
            string[] jidsplit = sJId.Split('@');
            if (jidsplit.GetUpperBound(0) == 2)
            {
                string[] serversplit = jidsplit[1].Split(':');
                if (serversplit.GetUpperBound(0) == 2)
                {
                    ServerIP = serversplit[0];
                    string[] resourcesplit = serversplit[1].Split('/');

                    ServerPort = Convert.ToInt32(resourcesplit[0]);
                    
                    if (resourcesplit.GetUpperBound(0) == 2)
                        resource = resourcesplit[1];

                    username = jidsplit[0];

                }
            }
        }

    }
}