Fossil SCM

Fix the "fossil chat send" command so that it sends the lmtime query parameter so that the chat display shows an appropriate local time.

drh 2021-01-05 02:13 trunk
Commit 62d67ed9a52e0fbffae5847ed923ce436422eabd22cf88e45197ced3aba89de2
1 file changed +7
+7
--- src/chat.c
+++ src/chat.c
@@ -757,10 +757,11 @@
757757
const char *zMsg = find_option("message","m",1);
758758
int allowUnsafe = find_option("unsafe",0,0)!=0;
759759
const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
760760
int i;
761761
const char *zPw;
762
+ char *zLMTime;
762763
Blob up, down, fcontent;
763764
char zBoundary[80];
764765
sqlite3_uint64 r[3];
765766
if( zFilename==0 && zMsg==0 ){
766767
fossil_fatal("must have --message or --file or both");
@@ -779,10 +780,16 @@
779780
blob_init(&down, 0, 0);
780781
sqlite3_randomness(sizeof(r),r);
781782
sqlite3_snprintf(sizeof(zBoundary),zBoundary,
782783
"--------%016llu%016llu%016llu", r[0], r[1], r[2]);
783784
blob_appendf(&up, "%s", zBoundary);
785
+ zLMTime = db_text(0,
786
+ "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S','now','localtime')");
787
+ if( zLMTime ){
788
+ blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"lmtime\"\r\n"
789
+ "\r\n%z\r\n%s", zLMTime, zBoundary);
790
+ }
784791
if( g.url.user && g.url.user[0] ){
785792
blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"resid\"\r\n"
786793
"\r\n%z\r\n%s", obscure(g.url.user), zBoundary);
787794
}
788795
zPw = g.url.passwd;
789796
--- src/chat.c
+++ src/chat.c
@@ -757,10 +757,11 @@
757 const char *zMsg = find_option("message","m",1);
758 int allowUnsafe = find_option("unsafe",0,0)!=0;
759 const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
760 int i;
761 const char *zPw;
 
762 Blob up, down, fcontent;
763 char zBoundary[80];
764 sqlite3_uint64 r[3];
765 if( zFilename==0 && zMsg==0 ){
766 fossil_fatal("must have --message or --file or both");
@@ -779,10 +780,16 @@
779 blob_init(&down, 0, 0);
780 sqlite3_randomness(sizeof(r),r);
781 sqlite3_snprintf(sizeof(zBoundary),zBoundary,
782 "--------%016llu%016llu%016llu", r[0], r[1], r[2]);
783 blob_appendf(&up, "%s", zBoundary);
 
 
 
 
 
 
784 if( g.url.user && g.url.user[0] ){
785 blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"resid\"\r\n"
786 "\r\n%z\r\n%s", obscure(g.url.user), zBoundary);
787 }
788 zPw = g.url.passwd;
789
--- src/chat.c
+++ src/chat.c
@@ -757,10 +757,11 @@
757 const char *zMsg = find_option("message","m",1);
758 int allowUnsafe = find_option("unsafe",0,0)!=0;
759 const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
760 int i;
761 const char *zPw;
762 char *zLMTime;
763 Blob up, down, fcontent;
764 char zBoundary[80];
765 sqlite3_uint64 r[3];
766 if( zFilename==0 && zMsg==0 ){
767 fossil_fatal("must have --message or --file or both");
@@ -779,10 +780,16 @@
780 blob_init(&down, 0, 0);
781 sqlite3_randomness(sizeof(r),r);
782 sqlite3_snprintf(sizeof(zBoundary),zBoundary,
783 "--------%016llu%016llu%016llu", r[0], r[1], r[2]);
784 blob_appendf(&up, "%s", zBoundary);
785 zLMTime = db_text(0,
786 "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S','now','localtime')");
787 if( zLMTime ){
788 blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"lmtime\"\r\n"
789 "\r\n%z\r\n%s", zLMTime, zBoundary);
790 }
791 if( g.url.user && g.url.user[0] ){
792 blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"resid\"\r\n"
793 "\r\n%z\r\n%s", obscure(g.url.user), zBoundary);
794 }
795 zPw = g.url.passwd;
796

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button