Merge: Benitlux mailing list: nicer and differentiate between streets
authorJean Privat <jean@pryen.org>
Mon, 31 Aug 2015 15:22:19 +0000 (11:22 -0400)
committerJean Privat <jean@pryen.org>
Mon, 31 Aug 2015 15:22:19 +0000 (11:22 -0400)
This is an ongoing effort to please GMail and the likes, so Benitlux emails are no longer sent to the spam folder. Which is vital to keep @R4PaSs happy, hydrated and productive.

This PR adds headers to the email to make it clear that it is a mailing list and to guide the assisted unsubscribe option. Specifying the street name will help differentiate between the emails from the two mailing lists. (One of which is not exposed on the website, it is available on request only.)

I've also added DKIM (to the existing SPF) as server identification, it should help a lot too.

Pull-Request: #1680
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Jean-Philippe Caissy <jpcaissy@piji.ca>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

20 files changed:
.mailmap
contrib/github_merge.nit
contrib/nitiwiki/src/wiki_base.nit
lib/core/text/abstract_text.nit
lib/core/text/flat.nit
lib/core/text/ropes.nit
lib/ini.nit
lib/nitcorn/examples/Makefile [moved from examples/nitcorn/Makefile with 100% similarity]
lib/nitcorn/examples/src/file_server_on_port_80.nit [moved from examples/nitcorn/src/file_server_on_port_80.nit with 100% similarity]
lib/nitcorn/examples/src/nitcorn_hello_world.nit [moved from examples/nitcorn/src/nitcorn_hello_world.nit with 100% similarity]
lib/nitcorn/examples/src/xymus_net.nit [moved from examples/nitcorn/src/xymus_net.nit with 100% similarity]
lib/nitcorn/examples/www/hello_world/dir/a.txt [moved from examples/nitcorn/www/hello_world/dir/a.txt with 100% similarity]
lib/nitcorn/examples/www/hello_world/dir/b.txt [moved from examples/nitcorn/www/hello_world/dir/b.txt with 100% similarity]
lib/nitcorn/examples/www/hello_world/favicon.ico [moved from examples/nitcorn/www/hello_world/favicon.ico with 100% similarity]
src/compiler/abstract_compiler.nit
src/interpreter/naive_interpreter.nit
src/loader.nit
src/rapid_type_analysis.nit
tests/sav/error_needed_method_alt3.res
tests/sav/niti/error_needed_method_alt4.res

index 452266a..a1e995c 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -26,3 +26,7 @@ Clement de Figueiredo <clement.defigueiredo@gmail.com>
 Christophe Gigax <christophe.gigax@viacesi.fr>
 
 Julien Pagès <julien.projet@gmail.com>
+
+Mehdi Ait Younes <overpex@gmail.com>
+
+Hervé Matysiak <herve.matysiak@viacesi.fr>
index 3a98c10..52afa49 100644 (file)
@@ -68,8 +68,8 @@ redef class GithubCurl
                var res = new Array[String]
                for l in logins do
                        var u = get_and_check("https://api.github.com/users/{l}").json_as_map
-                       if not u.has_key("name") then
-                               print "No public name for user {l}"
+                       if not u.has_key("name") or u["name"] == null or not u.has_key("email")or u["email"] == null then
+                               print "No public name/email for user {l}"
                                continue
                        end
                        var r = "{u["name"].to_s} <{u["email"].to_s}>"
index 8257091..5f093a0 100644 (file)
@@ -616,8 +616,7 @@ class WikiConfig
 
        # Returns the config value at `key` or return `default` if no key was found.
        private fun value_or_default(key: String, default: String): String do
-               if not has_key(key) then return default
-               return self[key]
+               return self[key] or else default
        end
 
        # Site name displayed.
index 9a88cc1..5cd317c 100644 (file)
@@ -1808,6 +1808,12 @@ redef class NativeString
 
        # Returns `self` as a String of `length`.
        fun to_s_with_length(length: Int): String is abstract
+
+       # Returns `self` as a String with `bytelen` and `length` set
+       #
+       # SEE: `abstract_text::Text` for more infos on the difference
+       # between `Text::bytelen` and `Text::length`
+       fun to_s_full(bytelen, unilen: Int): String is abstract
 end
 
 redef class NativeArray[E]
index 75cf729..2343f9f 100644 (file)
@@ -626,7 +626,7 @@ class FlatBuffer
        do
                written = true
                if bytelen == 0 then items = new NativeString(1)
-               return new FlatString.with_infos(items, bytelen, 0, bytelen - 1)
+               return new FlatString.full(items, bytelen, 0, bytelen - 1, length)
        end
 
        redef fun to_cstring
@@ -737,7 +737,7 @@ class FlatBuffer
 
        redef fun times(repeats)
        do
-               var x = new FlatString.with_infos(items, bytelen, 0, bytelen - 1)
+               var x = new FlatString.full(items, bytelen, 0, bytelen - 1, length)
                for i in [1 .. repeats[ do
                        append(x)
                end
@@ -922,6 +922,10 @@ redef class NativeString
                return str
        end
 
+       redef fun to_s_full(bytelen, unilen) do
+               return new FlatString.full(self, bytelen, 0, bytelen - 1, unilen)
+       end
+
        # Returns `self` as a new String.
        redef fun to_s_with_copy: FlatString
        do
index 2b3ff28..f582292 100644 (file)
@@ -559,7 +559,7 @@ redef class FlatString
                        var ns = new NativeString(nlen + 1)
                        mits.copy_to(ns, mlen, mifrom, 0)
                        sits.copy_to(ns, slen, sifrom, mlen)
-                       return ns.to_s_with_length(nlen)
+                       return new FlatString.full(ns, nlen, 0, nlen - 1, length + s.length)
                else if s isa Concat then
                        var sl = s.left
                        var sllen = sl.bytelen
index 2f81240..84b200c 100644 (file)
@@ -41,41 +41,32 @@ class ConfigTree
 
        # Get the config value for `key`
        #
-       # REQUIRE: `has_key(key)`
-       #
        #     var config = new ConfigTree("config.ini")
        #     assert config["goo"] == "goo"
        #     assert config["foo.bar"] == "foobar"
        #     assert config["foo.baz"] == "foobaz"
-       fun [](key: String): String do
-               if not has_key(key) then
-                       print "error: config key `{key}` not found"
-                       abort
-               end
-               var node = get_node(key).as(not null)
-               if node.value == null then
-                       print "error: config key `{key}` has no value"
-                       abort
-               end
-               return node.value.as(not null)
+       #     assert config["fail.fail"] == null
+       fun [](key: String): nullable String do
+               var node = get_node(key)
+               if node == null then return null
+               return node.value
        end
 
        # Get the config values under `key`
        #
-       # REQUIRE: `has_key(key)`
-       #
        #     var config = new ConfigTree("config.ini")
        #     var values = config.at("foo")
        #     assert values.has_key("bar")
        #     assert values.has_key("baz")
        #     assert not values.has_key("goo")
-       fun at(key: String): Map[String, String] do
-               if not has_key(key) then
-                       print "error: config key `{key}` not found"
-                       abort
-               end
+       #
+       # Return null if the key does not exists.
+       #
+       #     assert config.at("fail.fail") == null
+       fun at(key: String): nullable Map[String, String] do
+               var node = get_node(key)
+               if node == null then return null
                var map = new HashMap[String, String]
-               var node = get_node(key).as(not null)
                for k, child in node.children do
                        if child.value == null then continue
                        map[k] = child.value.to_s
@@ -278,7 +269,7 @@ class ConfigTree
        private fun get_node(key: String): nullable ConfigNode do
                var parts = key.split(".").reversed
                var node = get_root(parts.pop)
-               while not parts.is_empty do
+               while node != null and not parts.is_empty do
                        node = node.get_child(parts.pop)
                end
                return node
index b58d4a3..2f83449 100644 (file)
@@ -1598,8 +1598,9 @@ abstract class AbstractCompilerVisitor
                var native_mtype = mmodule.native_string_type
                var nat = self.new_var(native_mtype)
                self.add("{nat} = \"{string.escape_to_c}\";")
-               var length = self.int_instance(string.bytelen)
-               self.add("{res} = {self.send(self.get_property("to_s_with_length", native_mtype), [nat, length]).as(not null)};")
+               var bytelen = self.int_instance(string.bytelen)
+               var unilen = self.int_instance(string.length)
+               self.add("{res} = {self.send(self.get_property("to_s_full", native_mtype), [nat, bytelen, unilen]).as(not null)};")
                self.add("{name} = {res};")
                self.add("\}")
                return res
index 1181cf0..23a7b0c 100644 (file)
@@ -343,7 +343,7 @@ class NaiveInterpreter
        fun string_instance(txt: String): Instance
        do
                var nat = native_string_instance(txt)
-               var res = self.send(self.force_get_primitive_method("to_s_with_length", nat.mtype), [nat, self.int_instance(txt.bytelen)])
+               var res = self.send(self.force_get_primitive_method("to_s_full", nat.mtype), [nat, self.int_instance(txt.bytelen), self.int_instance(txt.length)])
                assert res != null
                return res
        end
index 6d7bbe7..eb3d06d 100644 (file)
@@ -460,8 +460,7 @@ redef class ModelBuilder
                var mgroup
                if parent == null then
                        # no parent, thus new project
-                       var namekey = "project.name"
-                       if ini != null and ini.has_key(namekey) then pn = ini[namekey]
+                       if ini != null then pn = ini["project.name"] or else pn
                        var mproject = new MProject(pn, model)
                        mgroup = new MGroup(pn, mproject, null) # same name for the root group
                        mproject.root = mgroup
index 9ef5320..bcdb6db 100644 (file)
@@ -581,7 +581,7 @@ redef class AStringFormExpr
        do
                var native = v.analysis.mainmodule.native_string_type
                v.add_type(native)
-               var prop = v.get_method(native, "to_s_with_length")
+               var prop = v.get_method(native, "to_s_full")
                v.add_monomorphic_send(native, prop)
        end
 end
index f7f479a..f06d6c6 100644 (file)
@@ -1 +1 @@
-alt/error_needed_method_alt3.nit:48,9--13: Fatal Error: `NativeString` must have a property named `to_s_with_length`.
+alt/error_needed_method_alt3.nit:48,9--13: Fatal Error: `NativeString` must have a property named `to_s_full`.
index 3626477..5b1731b 100644 (file)
@@ -1 +1 @@
-alt/error_needed_method_alt4.nit:49,10--14: Fatal Error: `NativeString` must have a property named `to_s_with_length`.
+alt/error_needed_method_alt4.nit:49,10--14: Fatal Error: `NativeString` must have a property named `to_s_full`.