[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-bugs] [bug #26771] DC servers list

From: Antonio Limone
Subject: [Mldonkey-bugs] [bug #26771] DC servers list
Date: Wed, 10 Jun 2009 08:31:35 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/2009042708 Fedora/3.0.10-1.fc10 Firefox/3.0.10


                 Summary: DC servers list
                 Project: mldonkey, a multi-networks file-sharing client
            Submitted by: tony71
            Submitted on: Wed 10 Jun 2009 08:31:32 AM GMT
                Category: DirectConnect-Plugin
                Severity: 3 - Normal
              Item Group: Program malfunction
                  Status: None
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.0.0
                 Release: None
        Operating System: Linux
         Binaries Origin: Binary from Savannah
                CPU type: Intel x86



If I use the servers list
function make_hublist_from_file in doesn't work because it
receive an XML file instead of a file in the form
<server name>|<server addr>|<server info>|<server nusers>
(the file in that format from is empty).
So i write the following functions to convert XML in a string in the expected
let rec compile_row x =
        let t = Xml.tag x in
        if t = "Hub" then
                (* let name = Charset.to_utf8 (Xml.attrib x "Name") in *)
                let name = Xml.attrib x "Name" in
                let address = Xml.attrib x "Address" in
                (* let info = Charset.to_utf8 (Xml.attrib x "Description") in
                let info = Xml.attrib x "Description" in
                let nusers = Xml.attrib x "Users" in
                String.concat "|" [name; address; info; nusers]
                find_hubs (Xml.children x)
        find_hubs l =
        match List.length l with
                0 -> ""
              | 1 -> compile_row (List.hd l)
              | n -> String.concat "\n" [compile_row (List.hd l); find_hubs
              ( l)]

and I think that only modifing a few lines of make_hublist_from_file can do
the trick:
(* Make hublist from file f, return hublist *)
let make_hublist_from_file f =
        let x = Xml.parse_file f in
  (* let s = File.to_string f in *)
  let s = find_hubs (Xml.children x) in 
the rest of the function is unchanged.
Unfortunately I'm not an Ocaml programmer so let me know if there is a better
way to resolv this problem.

Best Regards


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]