summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-09-26 22:26:11 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-09-26 22:26:11 (GMT)
commit02db731a963a7856e51868a6d591e1f0c15436e8 (patch)
tree9e0bebafeed2ac42223081733dfd041cd29e27e7 /src
parent6ed1e4110eb19b78f76154aa095a74414531f04c (diff)
Transmitted the database item flags thanks to the connections.
Diffstat (limited to 'src')
-rw-r--r--src/analysis/db/item-int.h1
-rw-r--r--src/analysis/db/item.c22
2 files changed, 13 insertions, 10 deletions
diff --git a/src/analysis/db/item-int.h b/src/analysis/db/item-int.h
index 8c13cd9..35fca94 100644
--- a/src/analysis/db/item-int.h
+++ b/src/analysis/db/item-int.h
@@ -70,7 +70,6 @@ struct _GDbItem
GObject parent; /* A laisser en premier */
timestamp_t created; /* Date de création */
- timestamp_t timestamp; /* Date dernière activité */
rle_string author; /* Utilisateur d'origine */
diff --git a/src/analysis/db/item.c b/src/analysis/db/item.c
index f9c4201..029b1d6 100644
--- a/src/analysis/db/item.c
+++ b/src/analysis/db/item.c
@@ -198,7 +198,6 @@ DBFeatures g_db_item_get_feature(const GDbItem *item)
void g_db_item_set_server_side(GDbItem *item)
{
init_timestamp(&item->created);
- item->timestamp = item->created;
}
@@ -277,14 +276,11 @@ gint g_db_item_cmp(GDbItem *a, GDbItem *b, bool with)
char *label_b; /* Etiquette de l'élément B */
if (with)
- result = cmp_timestamp(&a->timestamp, &b->timestamp);
+ result = cmp_timestamp(&a->created, &b->created);
else
result = 0;
if (result == 0)
- result = cmp_timestamp(&a->created, &b->created);
-
- if (result == 0)
{
label_a = g_db_item_get_label(a);
label_b = g_db_item_get_label(b);
@@ -357,14 +353,18 @@ gint g_db_item_compare_without_timestamp(GDbItem *a, GDbItem *b)
static bool _g_db_item_unpack(GDbItem *item, packed_buffer *pbuf)
{
bool result; /* Bilan à retourner */
+ uint32_t flags; /* Propriétés de l'élément */
result = unpack_timestamp(&item->created, pbuf);
if (result)
- result = unpack_timestamp(&item->timestamp, pbuf);
+ result = unpack_rle_string(&item->author, pbuf);
if (result)
- result = unpack_rle_string(&item->author, pbuf);
+ {
+ result = extract_packed_buffer(pbuf, &flags, sizeof(uint32_t), true);
+ g_db_item_set_flags(item, flags);
+ }
return result;
@@ -411,14 +411,18 @@ bool g_db_item_unpack(GDbItem *item, packed_buffer *pbuf)
static bool _g_db_item_pack(const GDbItem *item, packed_buffer *pbuf)
{
bool result; /* Bilan à retourner */
+ DbItemFlags flags; /* Propriétés de l'élément */
result = pack_timestamp(&item->created, pbuf);
if (result)
- result = pack_timestamp(&item->timestamp, pbuf);
+ result = pack_rle_string(&item->author, pbuf);
if (result)
- result = pack_rle_string(&item->author, pbuf);
+ {
+ flags = g_db_item_get_flags(item);
+ result = extend_packed_buffer(pbuf, (uint32_t []) { flags }, sizeof(uint32_t), true);
+ }
return result;