diff options
Diffstat (limited to 'OpenSim/Framework/JId.cs')
-rw-r--r-- | OpenSim/Framework/JId.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/OpenSim/Framework/JId.cs b/OpenSim/Framework/JId.cs new file mode 100644 index 0000000..790a9e0 --- /dev/null +++ b/OpenSim/Framework/JId.cs | |||
@@ -0,0 +1,42 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Framework | ||
6 | { | ||
7 | public class JId | ||
8 | { | ||
9 | public string ServerIP = String.Empty; | ||
10 | public int ServerPort = 0; | ||
11 | public string username = String.Empty; | ||
12 | public string resource = String.Empty; | ||
13 | |||
14 | public JId() | ||
15 | { | ||
16 | |||
17 | } | ||
18 | public JId(string sJId) | ||
19 | { | ||
20 | // user@address:port/resource | ||
21 | string[] jidsplit = sJId.Split('@'); | ||
22 | if (jidsplit.GetUpperBound(0) == 2) | ||
23 | { | ||
24 | string[] serversplit = jidsplit[1].Split(':'); | ||
25 | if (serversplit.GetUpperBound(0) == 2) | ||
26 | { | ||
27 | ServerIP = serversplit[0]; | ||
28 | string[] resourcesplit = serversplit[1].Split('/'); | ||
29 | |||
30 | ServerPort = Convert.ToInt32(resourcesplit[0]); | ||
31 | |||
32 | if (resourcesplit.GetUpperBound(0) == 2) | ||
33 | resource = resourcesplit[1]; | ||
34 | |||
35 | username = jidsplit[0]; | ||
36 | |||
37 | } | ||
38 | } | ||
39 | } | ||
40 | |||
41 | } | ||
42 | } | ||