[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com... |
Date: |
Sun, 11 Jun 2006 17:41:31 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 06/06/11 17:41:31
Modified files:
distrib : ChangeLog
src/daemon/common: commonMessages.ml guiDecoding.ml
src/daemon/driver: driverCommands.ml
Log message:
patch #5171
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.880&r2=1.881
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonMessages.ml?cvsroot=mldonkey&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/guiDecoding.ml?cvsroot=mldonkey&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverCommands.ml?cvsroot=mldonkey&r1=1.152&r2=1.153
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.880
retrieving revision 1.881
diff -u -b -r1.880 -r1.881
--- distrib/ChangeLog 11 Jun 2006 17:40:27 -0000 1.880
+++ distrib/ChangeLog 11 Jun 2006 17:41:30 -0000 1.881
@@ -15,6 +15,8 @@
=========
2006/06/11
+5171: New command group "Driver/Users",
+ print help text for "Bad number of arguments" error message
5170: Fix default max_indirect_connections, minimum is 30
5169: HTML, Options: add description to option section buttons,
remove 'save' button (schlumpf)
Index: src/daemon/common/commonMessages.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonMessages.ml,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- src/daemon/common/commonMessages.ml 18 May 2006 17:28:44 -0000 1.51
+++ src/daemon/common/commonMessages.ml 11 Jun 2006 17:41:30 -0000 1.52
@@ -882,7 +882,7 @@
let no_such_command = message "no_such_command"
(T.boption (T.string T.bformat)) "No such command %s\n"
-let bad_number_of_args = _s "Bad number of arguments"
+let bad_number_of_args cmd help = _s (Printf.sprintf "Bad number of arguments,
see help for correct use:\n%s %s" cmd help)
(* Colour arrays list for debug and devs
Index: src/daemon/common/guiDecoding.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/guiDecoding.ml,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- src/daemon/common/guiDecoding.ml 11 Jun 2006 17:37:38 -0000 1.56
+++ src/daemon/common/guiDecoding.ml 11 Jun 2006 17:41:30 -0000 1.57
@@ -999,7 +999,7 @@
| 5
| 52 ->
if proto < 14 then
- let pass,_ = get_string s 2 in Password (CommonUserDb.admin_user,
pass)
+ let pass = fst (get_string s 2) in Password
(CommonUserDb.admin_user, pass)
else
let pass,pos = get_string s 2 in
let login,pos = get_string s pos in
Index: src/daemon/driver/driverCommands.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -b -r1.152 -r1.153
--- src/daemon/driver/driverCommands.ml 11 Jun 2006 17:39:12 -0000 1.152
+++ src/daemon/driver/driverCommands.ml 11 Jun 2006 17:41:30 -0000 1.153
@@ -86,7 +86,7 @@
| Arg_one f, [arg] -> f arg output
| Arg_two f, [a1;a2] -> f a1 a2 output
| Arg_three f, [a1;a2;a3] -> f a1 a2 a3 output
- | _ -> bad_number_of_args
+ | _ -> bad_number_of_args command help
)
else
iter tail
@@ -632,135 +632,6 @@
), ":\t\t\t\t[<client num> <msg>]";
- "useradd", Arg_multiple (fun args o ->
- let buf = o.conn_buf in
- let print_result o result =
- if o.conn_output = HTML then
- html_mods_table_one_row buf "serversTable" "servers" [
- ("", "srh", result); ]
- else
- Printf.bprintf buf "%s" result
- in
- let add_new_user user pass mail =
- if o.conn_user == default_user
- || o.conn_user == (find_ui_user user) then
- try
- ignore (user2_find user);
- ignore (user2_add user (Md4.string pass) "");
- print_result o (Printf.sprintf "Password of user %s changed" user)
- with _ ->
- ignore (user2_add user (Md4.string pass) "");
- print_result o (Printf.sprintf "User %s added" user)
- else
- print_result o "Only 'admin' is allowed to add users"
- in begin
- match args with
- user :: pass :: mail :: _ ->
- add_new_user user pass mail
- | user :: pass :: _ ->
- add_new_user user pass "";
- | _ -> print_result o "Wrong syntax: use 'useradd user pass <mail>'"
- end;
- _s ""
- ), "<user> <passwd> [<mail>] :\t\tadd new mldonkey user/change user
password";
-
- "userdel", Arg_one (fun user o ->
- let buf = o.conn_buf in
- let print_result o result =
- if o.conn_output = HTML then
- html_mods_table_one_row buf "serversTable" "servers" [
- ("", "srh", result); ]
- else
- Printf.bprintf buf "%s" result
- in
- if o.conn_user == default_user then
- if user = admin_user then
- print_result o "User 'admin' can not be removed"
- else
- try
- ignore (user2_find user);
- ignore (user2_remove user);
- print_result o (Printf.sprintf "User %s removed" user)
- with _ ->
- print_result o (Printf.sprintf "User %s not found" user)
- else
- print_result o "Only 'admin' is allowed to remove users";
- _s ""
- ), "<user> :\t\t\tremove a mldonkey user";
-
-
- "users", Arg_none (fun o ->
- if o.conn_user == default_user then
-
- let buf = o.conn_buf in
-
- if use_html_mods o then begin
- Printf.bprintf buf "\\<div class=\\\"shares\\\"\\>\\<table
class=main cellspacing=0 cellpadding=0\\>
-\\<tr\\>\\<td\\>
-\\<table cellspacing=0 cellpadding=0 width=100%%\\>\\<tr\\>
-\\<td class=downloaded width=100%%\\>\\</td\\>
-\\<td nowrap class=\\\"fbig pr\\\"\\>\\<a onclick=\\\"javascript: {
- var getdir = prompt('Input: <user> <pass>','user pass')
- var reg = new RegExp (' ', 'gi') ;
- var outstr = getdir.replace(reg, '+');
- parent.fstatus.location.href='submit?q=useradd+' + outstr;
- setTimeout('window.location.reload()',1000);
- }\\\"\\>Add User\\</a\\>
-\\</td\\>
-\\</tr\\>\\</table\\>
-\\</td\\>\\</tr\\>
-\\<tr\\>\\<td\\>";
-
- html_mods_table_header buf "sharesTable" "shares" [
- ( "0", "srh ac", "Click to remove user", "Remove" ) ;
- ( "0", "srh", "User", "Username" ) ];
-
- let counter = ref 0 in
-
- user2_iter (fun name user ->
- incr counter;
- Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>"
- (if !counter mod 2 == 0 then "dl-1" else "dl-2");
- if user.user_name <> admin_user then Printf.bprintf buf "
- \\<td title=\\\"Click to remove user\\\"
- onMouseOver=\\\"mOvr(this);\\\"
- onMouseOut=\\\"mOut(this);\\\"
- onClick=\\\'javascript:{
-
parent.fstatus.location.href=\\\"submit?q=userdel+\\\\\\\"%s\\\\\\\"\\\";
- setTimeout(\\\"window.location.reload()\\\",1000);}'
- class=\\\"srb\\\"\\>Remove\\</td\\>" user.user_name
- else Printf.bprintf buf "
- \\<td title=\\\"\\\"
- class=\\\"srb\\\"\\>------\\</td\\>";
- Printf.bprintf buf
- "\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>" user.user_name
- );
-
- Printf.bprintf buf
"\\</table\\>\\</td\\>\\<tr\\>\\</table\\>\\</div\\>";
- end
- else
- begin
- Printf.bprintf buf "Users:\n";
- user2_iter (fun name user ->
- Printf.bprintf buf " %s\n"
- user.user_name);
- end;
- ""
- else
- _s "Only 'admin' is allowed to list users"
- ), ":\t\t\t\t\tprint users";
-
- "whoami", Arg_none (fun o ->
- let buf = o.conn_buf in
- let whoami = o.conn_user.ui_user_name in
- if use_html_mods o then
- html_mods_table_one_row buf "serversTable" "servers" [
- ("", "srh", whoami); ]
- else
- Printf.bprintf buf "%s" whoami;
- _s ""
- ), ":\t\t\t\tprint logged-in user name";
-
"calendar_add", Arg_two (fun hour action o ->
let buf = o.conn_buf in
calendar =:= ([0;1;2;3;4;5;6], [int_of_string hour], action)
@@ -2851,6 +2722,144 @@
]
+(*************************************************************************)
+(* *)
+(* Driver/Users *)
+(* *)
+(*************************************************************************)
+
+let _ =
+ register_commands "Driver/Users" [
+
+ "useradd", Arg_multiple (fun args o ->
+ let buf = o.conn_buf in
+ let print_result o result =
+ if o.conn_output = HTML then
+ html_mods_table_one_row buf "serversTable" "servers" [
+ ("", "srh", result); ]
+ else
+ Printf.bprintf buf "%s" result
+ in
+ let add_new_user user pass mail =
+ if o.conn_user == default_user
+ || o.conn_user == (find_ui_user user) then
+ try
+ ignore (user2_find user);
+ ignore (user2_add user (Md4.string pass) "");
+ print_result o (Printf.sprintf "Password of user %s changed" user)
+ with _ ->
+ ignore (user2_add user (Md4.string pass) "");
+ print_result o (Printf.sprintf "User %s added" user)
+ else
+ print_result o "Only 'admin' is allowed to add users"
+ in begin
+ match args with
+ user :: pass :: mail :: _ ->
+ add_new_user user pass mail
+ | user :: pass :: _ ->
+ add_new_user user pass "";
+ | _ -> print_result o "Wrong syntax: use 'useradd user pass <mail>'"
+ end;
+ _s ""
+ ), "<user> <passwd> [<mail>] :\tadd new mldonkey user/change user
password";
+
+ "userdel", Arg_one (fun user o ->
+ let buf = o.conn_buf in
+ let print_result o result =
+ if o.conn_output = HTML then
+ html_mods_table_one_row buf "serversTable" "servers" [
+ ("", "srh", result); ]
+ else
+ Printf.bprintf buf "%s" result
+ in
+ if o.conn_user == default_user then
+ if user = admin_user then
+ print_result o "User 'admin' can not be removed"
+ else
+ try
+ ignore (user2_find user);
+ ignore (user2_remove user);
+ print_result o (Printf.sprintf "User %s removed" user)
+ with _ ->
+ print_result o (Printf.sprintf "User %s not found" user)
+ else
+ print_result o "Only 'admin' is allowed to remove users";
+ _s ""
+ ), "<user> :\t\t\tremove a mldonkey user";
+
+
+ "users", Arg_none (fun o ->
+ if o.conn_user == default_user then
+
+ let buf = o.conn_buf in
+
+ if use_html_mods o then begin
+ Printf.bprintf buf "\\<div class=\\\"shares\\\"\\>\\<table
class=main cellspacing=0 cellpadding=0\\>
+\\<tr\\>\\<td\\>
+\\<table cellspacing=0 cellpadding=0 width=100%%\\>\\<tr\\>
+\\<td class=downloaded width=100%%\\>\\</td\\>
+\\<td nowrap class=\\\"fbig pr\\\"\\>\\<a onclick=\\\"javascript: {
+ var getdir = prompt('Input: <user> <pass>','user pass')
+ var reg = new RegExp (' ', 'gi') ;
+ var outstr = getdir.replace(reg, '+');
+ parent.fstatus.location.href='submit?q=useradd+' + outstr;
+ setTimeout('window.location.reload()',1000);
+ }\\\"\\>Add User\\</a\\>
+\\</td\\>
+\\</tr\\>\\</table\\>
+\\</td\\>\\</tr\\>
+\\<tr\\>\\<td\\>";
+
+ html_mods_table_header buf "sharesTable" "shares" [
+ ( "0", "srh ac", "Click to remove user", "Remove" ) ;
+ ( "0", "srh", "User", "Username" ) ];
+
+ let counter = ref 0 in
+
+ user2_iter (fun name user ->
+ incr counter;
+ Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>"
+ (if !counter mod 2 == 0 then "dl-1" else "dl-2");
+ if user.user_name <> admin_user then Printf.bprintf buf "
+ \\<td title=\\\"Click to remove user\\\"
+ onMouseOver=\\\"mOvr(this);\\\"
+ onMouseOut=\\\"mOut(this);\\\"
+ onClick=\\\'javascript:{
+
parent.fstatus.location.href=\\\"submit?q=userdel+\\\\\\\"%s\\\\\\\"\\\";
+ setTimeout(\\\"window.location.reload()\\\",1000);}'
+ class=\\\"srb\\\"\\>Remove\\</td\\>" user.user_name
+ else Printf.bprintf buf "
+ \\<td title=\\\"\\\"
+ class=\\\"srb\\\"\\>------\\</td\\>";
+ Printf.bprintf buf
+ "\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>" user.user_name
+ );
+
+ Printf.bprintf buf
"\\</table\\>\\</td\\>\\<tr\\>\\</table\\>\\</div\\>";
+ end
+ else
+ begin
+ Printf.bprintf buf "Users:\n";
+ user2_iter (fun name user ->
+ Printf.bprintf buf " %s\n"
+ user.user_name);
+ end;
+ ""
+ else
+ _s "Only 'admin' is allowed to list users"
+ ), ":\t\t\t\t\tprint users";
+
+ "whoami", Arg_none (fun o ->
+ let buf = o.conn_buf in
+ let whoami = o.conn_user.ui_user_name in
+ if use_html_mods o then
+ html_mods_table_one_row buf "serversTable" "servers" [
+ ("", "srh", whoami); ]
+ else
+ Printf.bprintf buf "%s" whoami;
+ _s ""
+ ), ":\t\t\t\tprint logged-in user name";
+ ]
(*************************************************************************)
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/06
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/06
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/06
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/06
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/09
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/11
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/11
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com...,
mldonkey-commits <=
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/12
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/12
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/12
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/12
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/12
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/15
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/18
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/18
- [Mldonkey-commits] mldonkey distribChangeLog src/daemon/common/com..., mldonkey-commits, 2006/06/19