Overview
SHA1 Hash: | a241c8111cd62aeb6a18f8a166d68ed77d97182d |
---|---|
Date: | 2008-05-17 22:18:44 |
User: | drh |
Comment: | Begin adding code to the sync logic to transfer configuration options upon request. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/xfer.c from [15d6dff0f1] to [be750bc3bc].
@@ -24,10 +24,39 @@ ** This file contains code to implement the file transfer protocol. */ #include "config.h" #include "xfer.h" +#if INTERFACE +/* +** Configuration transfers occur in groups. These are the allowed +** groupings: +*/ +#define CONFIGSET_SKIN 0x000001 /* WWW interface appearance */ +#define CONFIGSET_TKT 0x000002 /* Ticket configuration */ +#define CONFIGSET_PROJ 0x000004 /* Project name */ + +#endif /* INTERFACE */ + +/* +** The following is a list of settings that we are willing to +** transfer. +*/ +static struct { + const char *zName; /* Name of the configuration parameter */ + int groupMask; /* Which config groups is it part of */ +} aSafeConfig[] = { + { "css", CONFIGSET_SKIN }, + { "header", CONFIGSET_SKIN }, + { "footer", CONFIGSET_SKIN }, + { "project-name", CONFIGSET_PROJ }, + { "project-description", CONFIGSET_PROJ }, + { "index-page", CONFIGSET_SKIN }, + { "timeline-block-markup", CONFIGSET_SKIN }, + { "timeline-max-comment", CONFIGSET_SKIN }, +}; + /* ** This structure holds information about the current state of either ** a client or a server that is participating in xfer. */ typedef struct Xfer Xfer; @@ -625,10 +654,22 @@ }else if( check_tail_hash(&xfer.aToken[2], xfer.pIn) ){ check_login(&xfer.aToken[1], &xfer.aToken[2], &xfer.aToken[3]); } }else + /* reqconfig NAME + ** + ** Request a configuration value + */ + if( blob_eq(&xfer.aToken[0], "reqconfig") + && xfer.nToken==2 + ){ + /* TBD: Get the configuration name */ + /* Check to insure the configuration transfer is authorized */ + /* Construct the "config" message */ + }else + /* cookie TEXT ** ** A cookie contains a arbitrary-length argument that is server-defined. ** The argument must be encoded so as not to contain any whitespace. ** The server can optionally send a cookie to the client. The client @@ -746,10 +787,11 @@ if( cloneFlag ){ blob_appendf(&send, "clone\n"); pushFlag = 0; pullFlag = 0; nMsg++; + /* TBD: Request all transferable configuration values */ }else if( pullFlag ){ blob_appendf(&send, "pull %s %s\n", zSCode, zPCode); nMsg++; } if( pushFlag ){ @@ -880,10 +922,21 @@ db_set("project-code", zPCode, 0); } blob_appendf(&send, "clone\n"); nMsg++; }else + + /* config NAME SIZE \n CONTENT + ** + ** Receive a configuration value from the server. + */ + if( blob_eq(&xfer.aToken[0],"config") ){ + /* TBD: Extract name and content */ + /* Check to see if configuration name is authorized */ + /* Store content in the config table */ + }else + /* cookie TEXT ** ** The server might include a cookie in its reply. The client ** should remember this cookie and send it back to the server