mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
Date: Tue, 03 Jan 2006 18:41:40 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Branch:         
Changes by:     spiralvoice <address@hidden>    06/01/03 18:41:40

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonOptions.ml 

Log message:
        patch #4751

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.648&tr2=1.649&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonOptions.ml.diff?tr1=1.113&tr2=1.114&r1=text&r2=text

Patches:
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.648 mldonkey/distrib/ChangeLog:1.649
--- mldonkey/distrib/ChangeLog:1.648    Tue Jan  3 18:39:57 2006
+++ mldonkey/distrib/ChangeLog  Tue Jan  3 18:41:40 2006
@@ -12,6 +12,7 @@
 http://mldonkey.berlios.de/modules.php?name=Wiki&pagename=Windows
 
 2006/01/03
+4751: Ease use of messages_filter option (pango)
 4753: Allow upper case MD4 for ed2k-links in mldonkey_submit (fcrozat)
 4754: New parameter --auth for mldonkey_command (plf team)
 
Index: mldonkey/src/daemon/common/commonOptions.ml
diff -u mldonkey/src/daemon/common/commonOptions.ml:1.113 
mldonkey/src/daemon/common/commonOptions.ml:1.114
--- mldonkey/src/daemon/common/commonOptions.ml:1.113   Sun Jan  1 19:36:03 2006
+++ mldonkey/src/daemon/common/commonOptions.ml Tue Jan  3 18:41:40 2006
@@ -1132,7 +1132,7 @@
   "Allow others to browse our share list (0: none, 1: friends only, 2: 
everyone" allow_browse_share_option 1
 
 let messages_filter = define_option current_section ["messages_filter"]
-    "Regexp of messages to filter out, example: string1\\|string2\\|string3" 
string_option "Your client is connecting too fast"
+    "Regexp of messages to filter out, example: string1|string2|string3" 
string_option "Your client is connecting too fast"
 
 
 
@@ -1458,7 +1458,7 @@
 
 let options_version = define_expert_option current_section ["options_version"]
     "(internal option)"
-    int_option 5
+    int_option 7
 
 
 (*************************************************************************)
@@ -1753,10 +1753,39 @@
       BasicSocket.socket_keepalive := !!socket_keepalive
   )
 
+(* convert "|" to "\|" and "\|" to "|" *)
+let quote_unquote_bars m =
+  let len = String.length m in
+  let result = Buffer.create len in
+  let rec aux i =
+    if i = len then
+      Buffer.contents result
+    else match m.[i] with
+      | '|' -> 
+         Buffer.add_string result "\\|";
+         aux (i+1)
+      | '\\' -> 
+         aux_escaped (i+1)
+      | _ -> 
+         Buffer.add_char result m.[i];
+         aux (i+1)
+  and aux_escaped i =
+    if i = len then begin
+      Buffer.add_char result '\\';
+      Buffer.contents result
+    end else match m.[i] with
+      | '|' -> 
+         Buffer.add_char result '|';
+         aux (i+1)
+      | _ ->
+         Buffer.add_char result '\\';
+         aux i
+  in aux 0
+           
 let _ =
   option_hook messages_filter (fun _ ->
       is_not_spam := if !!messages_filter <> "" then
-        let r = Str.regexp_case_fold !!messages_filter in
+        let r = Str.regexp_case_fold (quote_unquote_bars !!messages_filter) in
         (fun s -> try
               ignore (Str.search_forward r s 0);
               false
@@ -1868,4 +1897,9 @@
           max_indirect_connections =:= 20;
       update 6
 
+  | 6 ->
+      (* it's more natural to use | instead of \| for simple case *) 
+      messages_filter =:= quote_unquote_bars !!messages_filter;
+      update 7
+
   | _ -> ()




reply via email to

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