From 5a52c25c6e2a77be1e06449f77f9b756f22310a4 Mon Sep 17 00:00:00 2001 From: ygrek Date: Mon, 3 May 2010 00:11:44 +0300 Subject: [PATCH] show dc buttons on all dc tabs --- src/networks/direct_connect/dcInteractive.ml | 86 +++++++++++++--------------- 1 file changed, 40 insertions(+), 46 deletions(-) diff --git a/src/networks/direct_connect/dcInteractive.ml b/src/networks/direct_connect/dcInteractive.ml index 376eab97..52c6c76d 100644 --- a/src/networks/direct_connect/dcInteractive.ml +++ b/src/networks/direct_connect/dcInteractive.ml @@ -603,48 +603,36 @@ let dc_info_print info data line o = Printf.bprintf buf "%s: %s\n" info data end - +let show_dc_buttons o = + let buf = o.conn_buf in + let button id ?(cmd="dc"^id) ?(txt=String.capitalize id) () = + Printf.bprintf buf "\\
+ \\\\\\\\" id id cmd txt + in + if use_html_mods o then + begin + Printf.bprintf buf "\\\\"; + button "users" ~cmd:"dcusers+all" (); + button "clients" ~cmd:"dcclients" (); + button "hubs" (); + button "shared" (); + button "files" (); + button "info" ~txt:"DC Info" (); + button "hublistshow" ~cmd:"dchublist" ~txt:"Show hublist" (); + button "filelists" (); + Printf.bprintf buf "\\\\"; + end + (* List of commands to register *) let commands = [ - + "dc", Arg_none (fun o -> - let buf = o.conn_buf in - if use_html_mods o then begin - Printf.bprintf buf "\\\\\\ - \\\\\\\\"; - Printf.bprintf buf "\\ - \\\\\\\\"; - Printf.bprintf buf "\\ - \\\\\\\\"; - Printf.bprintf buf "\\ - \\\\\\\\"; - Printf.bprintf buf "\\ - \\\\\\\\"; - Printf.bprintf buf "\\ - \\\\\\\\"; - Printf.bprintf buf "\\ - \\\\\\\\"; - Printf.bprintf buf "\\ - \\\\\\\\"; - Printf.bprintf buf "\\\\"; - end else - Printf.bprintf buf "Received command dc\n"; + if use_html_mods o then + show_dc_buttons o + else + Printf.bprintf buf "Try `?? dc` for more commands\n"; empty_string ), ": Show direct connect buttons"; @@ -666,11 +654,12 @@ let commands = [ ), " [] : Add a server. Default port number is 411"; (* List connected hubs for chatting *) - "dchubs", Arg_none (fun o -> dc_list o G_hubs "hubs" + "dchubs", Arg_none (fun o -> show_dc_buttons o; dc_list o G_hubs "hubs" ), ": Show connected DC hubs"; (* List all DC users *) "dcusers", Arg_one (fun args o -> + show_dc_buttons o; let buf = o.conn_buf in (match args with | "all" -> dc_list o G_users "users" @@ -692,19 +681,20 @@ let commands = [ ), "| :Show DC users"; (* List all DC clients *) - "dcclients", Arg_none (fun o -> dc_list o G_clients "clients" + "dcclients", Arg_none (fun o -> show_dc_buttons o; dc_list o G_clients "clients" ), ": Show all DC clients"; (* List all DC files *) - "dcfiles", Arg_none (fun o -> dc_list o G_files "files" + "dcfiles", Arg_none (fun o -> show_dc_buttons o; dc_list o G_files "files" ), ": Show all DC files"; (* List all DC shared files *) - "dcshared", Arg_none (fun o -> dc_list o G_shared "shared" + "dcshared", Arg_none (fun o -> show_dc_buttons o; dc_list o G_shared "shared" ), ": Show all DC shared files. All/Hashed "; - (* 'dchubs [args]' - Show dchub list with optional filters args (max 5) *) + (* 'dchublist [args]' - Show dchub list with optional filters args (max 5) *) "dchublist", Arg_multiple (fun args o -> + show_dc_buttons o; let buf = o.conn_buf in let filter = ref [] in let print_hublist () = @@ -860,6 +850,7 @@ let commands = [ ), " | "; "dcmessages", Arg_multiple (fun args o -> + show_dc_buttons o; let buf = o.conn_buf in let s,u = (match args with @@ -1069,6 +1060,7 @@ msgWindow.location.reload(); ), " : Download filelist from user"; "dcfilelists", Arg_none (fun o -> + show_dc_buttons o; let buf = o.conn_buf in html_mods_cntr_init (); let line = ref 1 in @@ -1148,6 +1140,7 @@ msgWindow.location.reload(); ), ": Find new source for a file"; "dcinfo", Arg_none (fun o -> + show_dc_buttons o; let buf = o.conn_buf in let server_list = let lst = ref [] in @@ -1188,6 +1181,7 @@ msgWindow.location.reload(); (* load filelist from user *) "dcshowfilelist", Arg_one (fun args o -> + show_dc_buttons o; let buf = o.conn_buf in (match args with | filename -> @@ -1369,10 +1363,10 @@ msgWindow.location.reload(); ), " : Set/unset the server autoconnection state"; ] (* end of let commands = *) - + module P = GuiTypes -(* register user operations *) +(* register user operations *) let _ = register_commands commands; -- 2.11.4.GIT