From 0470477bcc8d2670a57e8bc062a1a734a5038efe Mon Sep 17 00:00:00 2001 From: chrisparker126 Date: Sat, 5 Jun 2010 11:19:04 +0000 Subject: [PATCH] group modifications now propagate git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3067 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/rsiface/rsdistrib.h | 3 +++ libretroshare/src/services/p3distrib.cc | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/rsiface/rsdistrib.h b/libretroshare/src/rsiface/rsdistrib.h index de10574cc..7d0e0d591 100644 --- a/libretroshare/src/rsiface/rsdistrib.h +++ b/libretroshare/src/rsiface/rsdistrib.h @@ -30,6 +30,7 @@ #define RS_DISTRIB_PRIVACY_MASK 0x000f /* who can publish & view */ #define RS_DISTRIB_AUTHEN_MASK 0x00f0 /* how to publish */ #define RS_DISTRIB_LISTEN_MASK 0x0f00 /* distribution flags */ +#define RS_DISTRIB_UPDATE_MASK 0xf000 /* if sending a group info update */ #define RS_DISTRIB_PUBLIC 0x0001 /* anyone can publish */ #define RS_DISTRIB_PRIVATE 0x0002 /* anyone with key can publish */ @@ -42,5 +43,7 @@ #define RS_DISTRIB_PUBLISH 0x0200 #define RS_DISTRIB_SUBSCRIBED 0x0400 +#define RS_DISTRIB_UPDATE 0x1000 + #endif diff --git a/libretroshare/src/services/p3distrib.cc b/libretroshare/src/services/p3distrib.cc index 43ace4fdd..adecc10bf 100644 --- a/libretroshare/src/services/p3distrib.cc +++ b/libretroshare/src/services/p3distrib.cc @@ -894,6 +894,8 @@ void p3GroupDistrib::publishDistribGroups() { /* store in Cache File */ store->SendItem(grp); /* no delete */ + + grp->grpFlags &= (~RS_DISTRIB_UPDATE); // if this is an update, ensure flag is removed after publication } /* if they have public keys, publish these too */ @@ -2223,7 +2225,7 @@ bool p3GroupDistrib::locked_checkGroupInfo(GroupInfo &info, RsDistribGrp *newGr /* groupInfo */ /* If adminKey is the same and - * timestamp is <= timestamp, + * timestamp is <= timestamp, or not an update (info edit) * then just discard it. */ @@ -2237,7 +2239,7 @@ bool p3GroupDistrib::locked_checkGroupInfo(GroupInfo &info, RsDistribGrp *newGr } if ((info.distribGroup) && - (info.distribGroup->timestamp <= newGrp->timestamp)) + ((info.distribGroup->timestamp <= newGrp->timestamp) && !(newGrp->grpFlags & RS_DISTRIB_UPDATE))) { #ifdef DISTRIB_DEBUG std::cerr << "p3GroupDistrib::locked_checkGroupInfo() Group Data Old/Same"; @@ -2247,7 +2249,6 @@ bool p3GroupDistrib::locked_checkGroupInfo(GroupInfo &info, RsDistribGrp *newGr return false; } - /* otherwise validate it */ return validateDistribGrp(newGrp); } @@ -2351,6 +2352,8 @@ bool p3GroupDistrib::locked_editGroup(std::string grpId, GroupInfo& gi){ } + gi_curr->distribGroup->grpFlags |= RS_DISTRIB_UPDATE; + // create new signature for group EVP_PKEY *key_admin = gi_curr->adminKey.key;