text
stringlengths
0
601k
let take_data node = let rec aux = function | [ ] -> [ ] , [ ] | D d :: xs -> let ds , xs = aux xs in ( d :: ds ) , xs | n :: xs -> let ds , xs = aux xs in ds , ( n :: xs ) in let chosen , rest = aux node . children in node . children <- rest ; match chosen with | [ ] -> " " | [ d ] -> d | _ -> Fmt . failwith " Element...
let take_attr_opt name n = let ( let ) + x f = Option . map f x in let rec extract = function | [ ] -> None | ( ( " " , k ) , v ) :: xs when k = name -> Some ( v , xs ) | x :: xs -> let + r , xs = extract xs in r , ( x :: xs ) in let + r , xs = extract n . attrs in n . attrs <- xs ; r
let take_attr name node = match take_attr_opt name node with | Some x -> x | None -> Fmt . failwith " Missing attribute % S on % a " name pp node
let parse ~ name ch f = let input = Xmlm . make_input ( ` Channel ch ) in let rec aux ~ level = let pos = name , Xmlm . pos input in match Xmlm . input input with | ` El_start ( name , attrs ) -> let children = aux ~ level ( : succ level ) in let rest = if level = 0 then [ ] else aux ~ level in E { pos ; name ; attrs ;...
type readyState = | UNSENT | OPENED | HEADERS_RECEIVED | LOADING | DONE
type _ response = | ArrayBuffer : Typed_array . arrayBuffer t Opt . t response | Blob : # File . blob t Opt . t response | Document : Dom . element Dom . document t Opt . t response | JSON : ' a Opt . t response | Text : js_string t response | Default : string response object ( ' self ) method onreadystatechange : ( un...
module Event = struct type typ = xmlHttpRequest File . progressEvent t Dom . Event . typ let readystatechange = Dom . Event . make " readystatechange " let loadstart = Dom . Event . make " loadstart " let progress = Dom . Event . make " progress " let abort = Dom . Event . make " abort " let error = Dom . Event . make ...
module type String = sig type t val empty : t val length : t -> int val append : t -> t -> t val lowercase : t -> t val iter : ( int -> unit ) -> t -> unit val of_string : std_string -> t val to_utf_8 : ( ' a -> std_string -> ' a ) -> ' a -> t -> ' a val compare : t -> t -> int end
module type Buffer = sig type string type t exception Full val create : int -> t val add_uchar : t -> int -> unit val clear : t -> unit val contents : t -> string val length : t -> int end
module type S = sig type string type encoding = [ | ` UTF_8 | ` UTF_16 | ` UTF_16BE | ` UTF_16LE | ` ISO_8859_1 | ` US_ASCII ] type dtd = string option type name = string * string type attribute = name * string type tag = name * attribute list type signal = [ ` Dtd of dtd | ` El_start of tag | ` El_end | ` Data of stri...
let utf8_len = [ | 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1...
let uchar_utf8 i = let b0 = i ( ) in begin match utf8_len . ( b0 ) with | 0 -> raise Malformed | 1 -> b0 | 2 -> let b1 = i ( ) in if b1 lsr 6 != 0b10 then raise Malformed else ( ( b0 land 0x1F ) lsl 6 ) lor ( b1 land 0x3F ) | 3 -> let b1 = i ( ) in let b2 = i ( ) in if b2 lsr 6 != 0b10 then raise Malformed else begin m...
let int16_be i = let b0 = i ( ) in let b1 = i ( ) in ( b0 lsl 8 ) lor b1
let int16_le i = let b0 = i ( ) in let b1 = i ( ) in ( b1 lsl 8 ) lor b0
let uchar_utf16 int16 i = let c0 = int16 i in if c0 < 0xD800 || c0 > 0xDFFF then c0 else if c0 > 0xDBFF then raise Malformed else let c1 = int16 i in ( ( ( c0 land 0x3FF ) lsl 10 ) lor ( c1 land 0x3FF ) ) + 0x10000
let uchar_utf16be = uchar_utf16 int16_be
let uchar_utf16le = uchar_utf16 int16_le
let uchar_byte i = i ( )
let uchar_iso_8859_1 i = i ( )
let uchar_ascii i = let b = i ( ) in if b > 127 then raise Malformed else b
module Make ( String : String ) ( Buffer : Buffer with type string = String . t ) = struct type string = String . t let str = String . of_string let str_eq s s ' = ( compare s s ' ) = 0 let str_empty s = ( compare s String . empty ) = 0 let cat = String . append let str_of_char u = let b = Buffer . create 4 in Buffer ....
module String = struct type t = string let empty = " " let length = String . length let append = ( ^ ) let lowercase = String . lowercase_ascii let iter f s = let len = Std_string . length s in let pos = ref ~- 1 in let i ( ) = incr pos ; if ! pos = len then raise Exit else Char . code ( Std_string . get s ! pos ) in t...
module Buffer = struct type string = String . t type t = Buffer . t exception Full let create = Buffer . create let add_uchar b u = try let buf c = Buffer . add_char b ( Char . chr c ) in if u <= 0x007F then ( buf u ) else if u <= 0x07FF then ( buf ( 0xC0 lor ( u lsr 6 ) ) ; buf ( 0x80 lor ( u land 0x3F ) ) ) else if u...
let rec pp_list ( ? pp_sep = Format . pp_print_cut ) pp_v ppf = function pp_v ppf v ; if vs <> [ ] then ( pp_sep ppf ( ) ; pp_list ~ pp_sep pp_v ppf vs )
let pp_name ppf ( p , l ) = if p <> " " then pp ppf " % s :% s " p l else pp ppf " % s " l
let pp_attribute ppf ( n , v ) = pp ppf " [ @< 1 ( >% a , , @% S ) ] " @ pp_name n v
let pp_tag ppf ( name , atts ) = let pp_sep ppf ( ) = pp ppf " ; @ " in pp ppf " [ @< 1 ( >% a , , [ @@< 1 [ >% a ] ] ) ] " @@ pp_name name ( pp_list ~ pp_sep pp_attribute ) atts
let pp_dtd ppf = function
let pp_signal ppf = function
let encode = let translate = function | ' > ' -> Some " & gt ; " | ' < ' -> Some " & lt ; " | ' & ' -> Some " & amp ; " | ' " ' -> Some " & quot ; " | c when ( c >= ' \ x20 ' && c <= ' \ xff ' ) xff ' || c = ' \ x09 ' || c = ' \ x0a ' || c = ' \ x0d ' -> None | _ -> Some " " in Internals . encode translate
let rec add_value ( ? strict = false ) false f = function | Null -> f " < value >< nil /></ value " > | Int i -> f " < value " ; > if strict then f " < i8 " ; > f ( Int64 . to_string i ) i ; if strict then f " </ i8 " ; > f " </ value " > | Int32 i -> f " < value >< i4 " ; > f ( Int32 . to_string i ) i ; f " </ i4 ></ ...
let to_string ( ? strict = false ) false x = let buf = Buffer . create 128 in add_value ~ strict ( Buffer . add_string buf ) buf x ; Buffer . contents buf
let to_a ( ? strict = false ) false ~ empty ~ append x = let buf = empty ( ) in add_value ~ strict ( fun s -> append buf s ) s x ; buf
let string_of_call ( ? strict = false ) false call = let module B = Buffer in let buf = B . create 1024 in let add = B . add_string buf in add " <? xml version " =\ 1 . 0 " " ; \?> add " < methodCall >< methodName " ; > add ( encode call . name ) name ; add " </ methodName >< params " ; > List . iter ( fun p -> add " <...
let add_response ( ? strict = false ) false add response = let v = if response . success then Dict [ " Status " , String " Success " ; " Value " , response . contents ] else Dict [ " Status " , String " Failure " ; " ErrorDescription " , response . contents ] in add " <? xml version " =\ 1 . 0 " \?>< methodResponse >< ...
let string_of_response ( ? strict = false ) false response = let module B = Buffer in let buf = B . create 256 in let add = B . add_string buf in add_response ~ strict add response ; B . contents buf
let a_of_response ( ? strict = false ) false ~ empty ~ append response = let buf = empty ( ) in let add s = append buf s in add_response ~ strict add response ; buf
let debug_input input = let buf = Buffer . create 1024 in let rec aux tags = if not ( Xmlm . eoi input ) input then ( match Xmlm . input input with | ` El_start ( ( _ , tag ) tag , _ ) _ -> Buffer . add_string buf " " ; < Buffer . add_string buf tag ; Buffer . add_string buf " " ; > aux ( tag :: tags ) tags | ` El_end ...
let pretty_string_of_error got expected input = sprintf " Error : got ' % s ' while ' % s ' was expected when processing ' % s ' \ n " got expected ( debug_input input ) input
let parse_error got expected input = raise ( Parse_error ( got , expected , input ) input ) input
module Parser = struct let is_empty s = let is_empty = ref true in for i = 0 to String . length s - 1 do if s [ . i ] i <> ' \ n ' && s [ . i ] i <> ' ' && s [ . i ] i <> ' \ t ' then is_empty := false done ; ! is_empty let rec skip_empty input = match Xmlm . peek input with | ` Data d when is_empty d -> let _ = Xmlm ....
let of_string ? callback ? base64_decoder str = let input = Xmlm . make_input ( ` String ( 0 , str ) str ) str in ( match Xmlm . peek input with | ` Dtd _ -> ignore ( Xmlm . input input ) input | _ -> ( ) ) ; Parser . of_xml ? callback ? base64_decoder [ ] input
let of_a ? callback ? base64_decoder ~ next_char b = let aux ( ) = match next_char b with | Some c -> int_of_char c | None -> raise End_of_file in let input = Xmlm . make_input ( ` Fun aux ) aux in Parser . of_xml ? callback ? base64_decoder [ ] input
let call_of_string ? callback ? base64_decoder str = let input = Xmlm . make_input ( ` String ( 0 , str ) str ) str in ( match Xmlm . peek input with | ` Dtd _ -> ignore ( Xmlm . input input ) input | _ -> ( ) ) ; let name = ref " " in let params = ref [ ] in Parser . map_tag " methodCall " ( fun input -> name := Parse...
let response_of_fault ? callback ? base64_decoder input = Parser . map_tag " fault " ( fun input -> match Parser . of_xml ? callback ? base64_decoder [ ] input with | Dict d -> let fault_code = List . assoc " faultCode " d in let fault_string = List . assoc " faultString " d in failure ( Rpc . Enum [ String " fault " ;...
let response_of_success ? callback ? base64_decoder input = Parser . map_tag " params " ( fun input -> Parser . map_tag " param " ( fun input -> match Parser . of_xml ? callback ? base64_decoder [ ] input with | Dict d -> if List . mem_assoc " Status " d && List . assoc " Status " d = String " Success " && List . mem_a...
let response_of_input ? callback ? base64_decoder input = ( match Xmlm . peek input with | ` Dtd _ -> ignore ( Xmlm . input input ) input | _ -> ( ) ) ; Parser . map_tag " methodResponse " ( fun input -> Parser . skip_empty input ; match Xmlm . peek input with | ` El_start ( ( _ , " params ) " , _ ) _ -> response_of_su...
let response_of_string ? callback ? base64_decoder str = let input = Xmlm . make_input ( ` String ( 0 , str ) str ) str in response_of_input ? callback ? base64_decoder input
let response_of_in_channel ? callback ? base64_decoder chan = let input = Xmlm . make_input ( ` Channel chan ) chan in response_of_input ? callback ? base64_decoder input
let is_whitespace_only strings = List . for_all is_whitespace_only strings
let parse context namespace report tokens = let open_elements = ref [ ] in let namespaces = Namespace . Parsing . init namespace in let is_fragment = ref false in let fragment_allowed = ref true in let throw = ref ( fun _ -> ( ) ) in let ended = ref ( fun _ -> ( ) ) in let output = ref ( fun _ -> ( ) ) in let rec curre...
module Xml = struct type xml = | PCData of string | Tag of string * xml | Seq of xml * xml | Empty end
module Stax = struct type token = | Text of string | Open of string | Close of string let pp ppf = function | Text s -> Format . fprintf ppf " text % s " s | Open s -> Format . fprintf ppf " open % s " s | Close s -> Format . fprintf ppf " close % s " s ; ; let equal f d1 d2 = match ( d1 , d2 ) with | Text t1 , Text t2...
module Monoid = Preface_stdlib . List . Monoid ( struct type t = Stax . token end )
module Writer = Preface . Writer . Over ( Monoid )
let rec sax_like = let open Xml in let open Stax in let open Writer in function | PCData s -> tell [ Text s ] | Tag ( n , x ) -> let * _ = tell [ Open n ] in let * _ = sax_like x in let * _ = tell [ Close n ] in return ( ) | Seq ( x1 , x2 ) -> let * _ = sax_like x1 in let * _ = sax_like x2 in return ( ) | Empty -> retu...
let sax = Alcotest . testable Stax . pp ( Stax . equal ( = ) )
let should_transform_a_pcdata ( ) = let open Writer in let expected = Stax . [ Text " Hello World " ] and _ , computed = run_identity ( sax_like Xml . ( PCData " Hello World " ) ) in Alcotest . ( check ( list sax ) ) " transform_a_pcdata " expected computed ; ;
let should_transform_a_tag ( ) = let open Writer in let expected = Stax . [ Open " A " ; Close " A " ] and _ , computed = run_identity ( sax_like Xml . ( Tag ( " A " , Empty ) ) ) in Alcotest . ( check ( list sax ) ) " transform_a_tag " expected computed ; ;
let should_transform_a_sequence ( ) = let open Writer in let expected = Stax . [ Open " A " ; Close " A " ; Text " Hello World " ] and _ , computed = run_identity ( sax_like Xml . ( Seq ( Tag ( " A " , Empty ) , PCData " Hello World " ) ) ) in Alcotest . ( check ( list sax ) ) " transform_a_sequence " expected computed...
let should_transform_empty ( ) = let open Writer in let expected = [ ] and _ , computed = run_identity ( sax_like Xml . Empty ) in Alcotest . ( check ( list sax ) ) " transform_empty " expected computed ; ;
let cases = let open Alcotest in [ ( " Xml to Stax reader " , [ test_case " Should transform a pcdata " ` Quick should_transform_a_pcdata ; test_case " Should transform a tag " ` Quick should_transform_a_tag ; test_case " Should transform a sequence " ` Quick should_transform_a_sequence ; test_case " Should transform e...
type token = [ ` Xml of xml_declaration | ` Doctype of doctype | ` Start of Token_tag . t | ` End of Token_tag . t | ` Chars of string list | ` PI of string * string | ` Comment of string | ` EOF ]
let is_name_start_char c = is_in_range 0x0041 0x005A c || is_in_range 0x0061 0x007A c || c = 0x003A || c = 0x005F || is_in_range 0x00C0 0x00D6 c || is_in_range 0x00D8 0x00F6 c || is_in_range 0x00F8 0x02FF c || is_in_range 0x0370 0x037D c || is_in_range 0x037F 0x1FFF c || is_in_range 0x200C 0x200D c || is_in_range 0x207...
let is_name_char c = is_name_start_char c || is_in_range 0x0030 0x0039 c || c = 0x002D || c = 0x002E || c = 0x00B7 || is_in_range 0x0300 0x036F c || is_in_range 0x203F 0x2040 c
let resolve_builtin_reference = function | " quot " -> Some " " " \ | " amp " -> Some " " & | " apos " -> Some " ' " | " lt " -> Some " " < | " gt " -> Some " " > | _ -> None
let tokenize report resolve_reference ( input , get_location ) = let resolve_reference s = match resolve_builtin_reference s with | Some _ as v -> v | None -> resolve_reference s in let report_if = Error . report_if report in let throw = ref ( fun _ -> ( ) ) in let ended = ref ( fun _ -> ( ) ) in let output = ref ( fun...
let escape s = let buffer = Buffer . create ( String . length s ) in String . iter ( function | ' " ' -> Buffer . add_string buffer " & quot ; " | ' ' & -> Buffer . add_string buffer " & amp ; " | ' ' ' \ -> Buffer . add_string buffer " & apos ; " | ' ' < -> Buffer . add_string buffer " & lt ; " | ' ' > -> Buffer . add...
let attribute_strings end_ attributes = let rec prepend_attributes words = function | [ ] -> words | ( name , value ) :: more -> prepend_attributes ( " " :: name " " " ( ::=\:: escape value ) " " " ::\:: words ) more in prepend_attributes [ end_ ] ( List . rev attributes )
let write report prefix signals = let signals = enumerate signals in let open_elements = ref [ ] in let namespaces = Namespace . Writing . init prefix in let rec queue = ref next_signal and emit_list l throw e k = match l with | [ ] -> next_signal throw e k | s :: more -> queue := emit_list more ; k s and next_signal t...
let array_call = " < methodCall >\ n \ \ < methodName > event . register </ methodName >\ n \ \ < params >\ n \ \ < param >\ n \ \ < value > OpaqueRef : 8ecbbb2a - a905 - d422 - 1153 - fadc00639b12 </ value >\ n \ \ </ param >\ n \ \ < param >\ n \ \ < value >\ n \ \ < array >\ n \ \ < data >\ n \ \ < value > pbd </ va...
let simple_call = " < methodCall >\ n \ \ < methodName > session . login_with_password </ methodName >\ n \ \ < params >\ n \ \ < param >\ n \ \ < value />\ n \ \ </ param >\ n \ \ < param >\ n \ \ < value />\ n \ \ </ param >\ n \ \ < param >\ n \ \ < value > 1 . 4 </ value >\ n \ \ </ param >\ n \ \ </ params >\ n \ ...
let error = " < methodResponse >\ n \ < fault >\ n \ < value >< struct >\ n \ < member >\ n \ < name > faultCode </ name >\ n \ < value >< int > 143 </ int ></ value >\ n \ </ member >\ n \ < member >\ n \ < name > faultString </ name >\ n \ < value >< string > Failed to parse the request </ string ></ value >\ n \ </ ...
let sm = " <? xml version = ' 1 . 0 ' ?>\ n \ < methodResponse >\ n \ < params >\ n \ < param >\ n \ < value >< struct >\ n \ < member >\ n \ < name > required_api_version </ name >\ n \ < value >< string > 1 . 0 </ string ></ value >\ n \ </ member >\ n \ < member >\ n \ < name > vendor </ name >\ n \ < value >< strin...
let base64 = " \ n \ \ < methodResponse >\ n \ < params >\ n \ < param >\ n \ < value >< base64 > SGVsbG8sIHdvcmxkIQ ==</ base64 ></ value >\ n \ </ param >\ n \ </ params >\ n \ </ methodResponse >\ n \ n "
let base64_call = " < methodCall >\ n \ \ < methodName > send_file </ methodName >\ n \ \ < params >\ n \ \ < param >\ n \ \ < value >\ n \ \ < base64 > SGVsbG8sIHdvcmxkIQ ==</ base64 > </ value >\ n \ \ </ param >\ n \ \ </ params >\ n \ </ methodCall >\ n "
let run ( ) = Printf . printf " Parsing SM XML . . . " ; %! let _ = Xmlrpc . response_of_string sm in Printf . printf " OK \ nParsing empty tags . . . " ; %! let _ = Xmlrpc . of_string empty in Printf . printf " OK \ nParsing error . . . " ; %! let _ = Xmlrpc . response_of_string error in Printf . printf " OK \ nParsin...
let tests = [ " Xapi XML tests " , ` Quick , run ]
module ID = struct type t = string let compare = String . compare end
module XMPPClient = XMPP . Make ( Lwt ) Lwt ( Xmlstream . XmlStream ) XmlStream ( IDCallback ) IDCallback
let stanza_error_to_str se = String . concat " " [ string_of_error_type se . err_type ; string_of_condition se . err_condition ; se . err_text ; se . err_lang ]
let presence_to_xmpp = function | ` Offline -> ( Some Unavailable , None ) None | ` Online -> ( None , None ) None | ` Free -> ( None , Some ShowChat ) ShowChat | ` Away -> ( None , Some ShowAway ) ShowAway | ` DoNotDisturb -> ( None , Some ShowDND ) ShowDND | ` ExtendedAway -> ( None , Some ShowXA ) ShowXA
let xmpp_to_presence = function | None -> ` Online | Some ShowChat -> ` Free | Some ShowAway -> ` Away | Some ShowDND -> ` DoNotDisturb | Some ShowXA -> ` ExtendedAway
module Version = XEP_version . Make ( XMPPClient ) XMPPClient
module Disco = XEP_disco . Make ( XMPPClient ) XMPPClient
module Roster = Roster . Make ( XMPPClient ) XMPPClient
module Xep_muc = XEP_muc . Make ( XMPPClient ) XMPPClient
type user_data = { log : ? kind : User . chatkind -> User . direction -> string -> unit Lwt . t ; locallog : ? kind : User . chatkind -> string -> string -> unit Lwt . t ; message : Xjid . bare_jid -> string option -> ? timestamp : Ptime . t -> string -> unit Lwt . t ; group_message : Xjid . t -> Ptime . t option -> st...
let request_disco t jid = let callback ev jid_from _jid_to _lang ( ) = let receipt = match ev with | IQError _ -> ` Unsupported | IQResult el -> match el with | Some ( Xml . Xmlelement ( ( ns , " query ) " , _ , els ) els ) els when ns = Disco . ns_disco_info -> let receipt = match ns_receipts with None -> assert false...
module Keepalive = struct let ping_urn = " urn : xmpp : ping " let keepalive_running : bool ref = ref false let keepalive_ping t = let callback _ev _jid_from _jid_to _lang ( ) = keepalive_running := false ; Lwt . return_unit in if ! keepalive_running then fail ( Invalid_argument " ping timeout ) " else let jid_to = JID...
let send_msg t ( ? kind = Chat ) Chat jid receipt id body = let x = match receipt , id with | true , Some _ -> [ Xml . Xmlelement ( ( ns_receipts , " request ) " , [ ] , [ ] ) ] | _ -> [ ] in let jid_to = Xjid . jid_to_xmpp_jid jid in send_message t ~ kind ~ jid_to ~ body ~ x ? id ( )
let delayed_timestamp = function | None -> None | Some delay -> match Ptime . of_rfc3339 delay . delay_stamp with | Ok ( time , _ , _ ) _ -> Some time | Error _ -> None
let receipt_id = function | Xml . Xmlelement ( ( ns_rec , " received ) " , attrs , _ ) _ when ns_rec = ns_receipts -> ( match Xml . safe_get_attr_value " id " attrs with | " " -> [ ] | id -> [ id ] id ) id | _ -> [ ]
let answer_receipt stanza_id = function | Xml . Xmlelement ( ( ns_rec , " request ) " , _ , _ ) _ when ns_rec = ns_receipts -> let qname = ( ns_receipts , " received ) " in [ Xml . Xmlelement ( qname , [ Xml . make_attr " id " stanza_id ] stanza_id , [ ] ) ] | _ -> [ ]
let maybe_element qname x = try Some ( Xml . get_element qname x ) x with Not_found -> None
let message_callback ( t : user_data session_data ) session_data stanza = Keepalive . restart_keepalive t ; match stanza . jid_from with | None -> t . user_data . locallog " error " " no from in stanza " | Some jidt -> let jid = Xjid . xmpp_jid_to_jid jidt in match stanza . content . message_type with | Some Groupchat ...
let message_error t ? id ? jid_from ? jid_to ? lang error = Keepalive . restart_keepalive t ; ignore id ; ignore jid_to ; ignore lang ; let jid = match jid_from with | None -> ` Bare ( " unknown " , " host ) " | Some x -> Xjid . xmpp_jid_to_jid x in let msg = let con = " error ; reason : " ^ ( string_of_condition error...
let presence_callback t stanza = Keepalive . restart_keepalive t ; match stanza . jid_from with | None -> t . user_data . locallog " error " " presence received without sending jid , ignoring " | Some jidt -> let jid = Xjid . xmpp_jid_to_jid jidt and status = match stanza . content . status with | None -> None | Some x...
let presence_error t ? id ? jid_from ? jid_to ? lang error = Keepalive . restart_keepalive t ; ignore id ; ignore jid_to ; ignore lang ; let jid = match jid_from with | None -> ` Bare ( " unknown " , " host ) " | Some x -> Xjid . xmpp_jid_to_jid x in let msg = let con = " presence error ; reason : " ^ ( string_of_condi...
let roster_callback item = try let subscription = match item . Roster . subscription with | Roster . SubscriptionRemove -> ` Remove | Roster . SubscriptionBoth -> ` Both | Roster . SubscriptionNone -> ` None | Roster . SubscriptionFrom -> ` From | Roster . SubscriptionTo -> ` To in let properties = let app = if item . ...