@@ -396,9 +396,11 @@ int NoteGetEnvInt(const char *variable, int defaultVal) {
396396 @param defaultVal The variable value.
397397 @param buf (out) The buffer in which to place the variable value.
398398 @param buflen The length of the output buffer.
399+ @returns true if there is no error (JSON response with no explicit error)
399400*/
400401/**************************************************************************/
401- void NoteGetEnv (const char * variable , const char * defaultVal , char * buf , uint32_t buflen ) {
402+ bool NoteGetEnv (const char * variable , const char * defaultVal , char * buf , uint32_t buflen ) {
403+ bool success = false;
402404 if (defaultVal == NULL )
403405 buf [0 ] = '\0' ;
404406 else
@@ -409,13 +411,15 @@ void NoteGetEnv(const char *variable, const char *defaultVal, char *buf, uint32_
409411 J * rsp = NoteRequestResponse (req );
410412 if (rsp != NULL ) {
411413 if (!NoteResponseError (rsp )) {
414+ success = true;
412415 char * val = JGetString (rsp , "text" );
413416 if (val [0 ] != '\0' )
414417 strlcpy (buf , val , buflen );
415418 }
416419 NoteDeleteResponse (rsp );
417420 }
418421 }
422+ return success ;
419423}
420424
421425//**************************************************************************/
@@ -830,7 +834,7 @@ bool NoteWake(int stateLen, void *state) {
830834 return false;
831835
832836 // Send it a command to request the saved state
833- JAddBoolToObject (req , "sync " , true);
837+ JAddBoolToObject (req , "start " , true);
834838 J * rsp = NoteRequestResponse (req );
835839 if (rsp == NULL )
836840 return false;
@@ -1074,7 +1078,7 @@ bool NoteAdd(const char *target, J *body, bool urgent) {
10741078
10751079 // Initiate sync NOW if it's urgent
10761080 if (urgent )
1077- JAddBoolToObject (req , "sync " , true);
1081+ JAddBoolToObject (req , "start " , true);
10781082
10791083 // Perform the transaction
10801084 return NoteRequest (req );
@@ -1216,8 +1220,8 @@ bool NoteGetContact(char *nameBuf, int nameBufLen, char *orgBuf, int orgBufLen,
12161220 strlcpy (roleBuf , JGetString (rsp , "role" ), roleBufLen );
12171221 if (emailBuf != NULL )
12181222 strlcpy (emailBuf , JGetString (rsp , "email" ), emailBufLen );
1219- NoteDeleteResponse (rsp );
12201223 }
1224+ NoteDeleteResponse (rsp );
12211225 }
12221226
12231227 return success ;
0 commit comments