new message has X-pEp-Version
authorvb
Tue, 10 Mar 2015 15:45:02 +0100
changeset 97b855132fb7e3
parent 96 fe4931a0413b
child 98 9e3d28932e7b
new message has X-pEp-Version
src/transport.c
     1.1 --- a/src/transport.c	Tue Mar 10 15:27:29 2015 +0100
     1.2 +++ b/src/transport.c	Tue Mar 10 15:45:02 2015 +0100
     1.3 @@ -310,12 +310,6 @@
     1.4      return _stringpair_map_dup(src, NULL);
     1.5  }
     1.6  
     1.7 -static bool stringpair_map_is_leave(const stringpair_map_t *node)
     1.8 -{
     1.9 -    assert(node);
    1.10 -    return node->left == NULL && node->right == NULL;
    1.11 -}
    1.12 -
    1.13  DYNAMIC_API stringpair_map_t * stringpair_map_find(
    1.14          stringpair_map_t *map,
    1.15          const char *key
    1.16 @@ -328,7 +322,7 @@
    1.17      if (map == NULL || map->pair == NULL) // empty map
    1.18          return NULL;
    1.19  
    1.20 -    c = strcmp(map->pair->key, key);
    1.21 +    c = strcoll(map->pair->key, key);
    1.22  
    1.23      if (c == 0)
    1.24          return map;
    1.25 @@ -378,7 +372,7 @@
    1.26      assert(map->pair->key);
    1.27      assert(pair->key);
    1.28  
    1.29 -    c = strcmp(map->pair->key, pair->key);
    1.30 +    c = strcoll(map->pair->key, pair->key);
    1.31      if (c == 0) {
    1.32          free(map->pair->value);
    1.33  
    1.34 @@ -461,6 +455,7 @@
    1.35  {
    1.36      map->parent_ref->color = rbt_black;
    1.37      stringpair_map_grandparent(map)->color = rbt_red;
    1.38 +
    1.39      if (map == map->parent_ref->left &&
    1.40              map->parent_ref == stringpair_map_grandparent(map)->left) {
    1.41          stringpair_map_rotate_right(stringpair_map_grandparent(map));
    1.42 @@ -572,6 +567,16 @@
    1.43      msg->from = from;
    1.44      msg->to = to;
    1.45  
    1.46 +    stringpair_t version;
    1.47 +    version.key = "X-pEp-Version";
    1.48 +    version.value = PEP_VERSION;
    1.49 +
    1.50 +    msg->opt_fields = new_stringpair_map(&version);
    1.51 +    if (msg->opt_fields == NULL) {
    1.52 +        free_message(msg);
    1.53 +        return NULL;
    1.54 +    }
    1.55 +
    1.56      return msg;
    1.57  }
    1.58