mldonkey-bugs
[Top][All Lists]
Advanced

[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:1.9.0.10) Gecko/2009042708 Fedora/3.0.10-1.fc10 Firefox/3.0.10

URL:
  <http://savannah.nongnu.org/bugs/?26771>

                 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

    _______________________________________________________

Details:

If I use the servers list
http://dchublist.com/hublist.xml.bz2
function make_hublist_from_file in dcServers.ml 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 dchublist.com is empty).
So i write the following functions to convert XML in a string in the expected
format:
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]
        else
                find_hubs (Xml.children x)
and
        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
              (List.tl 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
Tony




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?26771>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

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