@@ -396,9 +396,11 @@ int NoteGetEnvInt(const char *variable, int defaultVal) {
396
396
@param defaultVal The variable value.
397
397
@param buf (out) The buffer in which to place the variable value.
398
398
@param buflen The length of the output buffer.
399
+ @returns true if there is no error (JSON response with no explicit error)
399
400
*/
400
401
/**************************************************************************/
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;
402
404
if (defaultVal == NULL )
403
405
buf [0 ] = '\0' ;
404
406
else
@@ -409,13 +411,15 @@ void NoteGetEnv(const char *variable, const char *defaultVal, char *buf, uint32_
409
411
J * rsp = NoteRequestResponse (req );
410
412
if (rsp != NULL ) {
411
413
if (!NoteResponseError (rsp )) {
414
+ success = true;
412
415
char * val = JGetString (rsp , "text" );
413
416
if (val [0 ] != '\0' )
414
417
strlcpy (buf , val , buflen );
415
418
}
416
419
NoteDeleteResponse (rsp );
417
420
}
418
421
}
422
+ return success ;
419
423
}
420
424
421
425
//**************************************************************************/
@@ -830,7 +834,7 @@ bool NoteWake(int stateLen, void *state) {
830
834
return false;
831
835
832
836
// Send it a command to request the saved state
833
- JAddBoolToObject (req , "sync " , true);
837
+ JAddBoolToObject (req , "start " , true);
834
838
J * rsp = NoteRequestResponse (req );
835
839
if (rsp == NULL )
836
840
return false;
@@ -1074,7 +1078,7 @@ bool NoteAdd(const char *target, J *body, bool urgent) {
1074
1078
1075
1079
// Initiate sync NOW if it's urgent
1076
1080
if (urgent )
1077
- JAddBoolToObject (req , "sync " , true);
1081
+ JAddBoolToObject (req , "start " , true);
1078
1082
1079
1083
// Perform the transaction
1080
1084
return NoteRequest (req );
@@ -1216,8 +1220,8 @@ bool NoteGetContact(char *nameBuf, int nameBufLen, char *orgBuf, int orgBufLen,
1216
1220
strlcpy (roleBuf , JGetString (rsp , "role" ), roleBufLen );
1217
1221
if (emailBuf != NULL )
1218
1222
strlcpy (emailBuf , JGetString (rsp , "email" ), emailBufLen );
1219
- NoteDeleteResponse (rsp );
1220
1223
}
1224
+ NoteDeleteResponse (rsp );
1221
1225
}
1222
1226
1223
1227
return success ;
0 commit comments