aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/jid.ml11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/jid.ml b/lib/jid.ml
index bbcd2a6..3564c5d 100644
--- a/lib/jid.ml
+++ b/lib/jid.ml
@@ -30,6 +30,17 @@ let uchars_of_string s : uchars =
loop ((u, i) :: acc) (i + k)
in loop [] 0
+(** Convert a [string] to a [Jid.t].
+
+ This function traverses the JID until an '/' char (or the end of the string) occurs.
+
+ Anything before is the "bare" JID, and anything eventually after is the resource.
+
+ Then, the function goes backward until an '@' char (or the start of the string)
+ occurs.
+
+ Anything after is the domain, and anything eventually before is the localpart
+ (username). *)
let of_string (jid : string) : t =
let open List in
let open String in