Fossil SCM

Fix misinteraction of the chat send command and the chat search index.

stephan 2024-08-08 12:10 trunk
Commit 892dfd2b5510d628c5cfe6c804117fb447952c54882f1a9fb536d84ae84f2f85
1 file changed +3 -5
+3 -5
--- src/chat.c
+++ src/chat.c
@@ -422,18 +422,16 @@
422422
login_check_credentials();
423423
if( 0==g.perm.Chat ) {
424424
chat_emit_permissions_error(0);
425425
return;
426426
}
427
- if( !db_table_exists("repository","chat") ){
428
- return;
429
- }
430427
zUserName = (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody";
431428
nByte = atoi(PD("file:bytes","0"));
432429
zMsg = PD("msg","");
433430
db_begin_write();
434431
db_unprotect(PROTECT_READONLY);
432
+ chat_create_tables();
435433
chat_purge();
436434
if( nByte==0 ){
437435
if( zMsg[0] ){
438436
db_multi_exec(
439437
"INSERT INTO chat(mtime,lmtime,xfrom,xmsg)"
@@ -453,12 +451,12 @@
453451
db_bind_blob(&q, ":file", &b);
454452
db_step(&q);
455453
db_finalize(&q);
456454
blob_reset(&b);
457455
}
458
- db_protect_pop();
459456
db_commit_transaction();
457
+ db_protect_pop();
460458
}
461459
462460
/*
463461
** This routine receives raw (user-entered) message text and
464462
** transforms it into HTML that is safe to insert using innerHTML. As
@@ -1265,11 +1263,11 @@
12651263
#else
12661264
zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl);
12671265
#endif
12681266
fossil_system(zCmd);
12691267
}else if( strcmp(g.argv[2],"send")==0 ){
1270
- const char *zFilename = find_option("file","r",1);
1268
+ const char *zFilename = find_option("file","f",1);
12711269
const char *zAs = find_option("as",0,1);
12721270
const char *zMsg = find_option("message","m",1);
12731271
int allowUnsafe = find_option("unsafe",0,0)!=0;
12741272
const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
12751273
int i;
12761274
--- src/chat.c
+++ src/chat.c
@@ -422,18 +422,16 @@
422 login_check_credentials();
423 if( 0==g.perm.Chat ) {
424 chat_emit_permissions_error(0);
425 return;
426 }
427 if( !db_table_exists("repository","chat") ){
428 return;
429 }
430 zUserName = (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody";
431 nByte = atoi(PD("file:bytes","0"));
432 zMsg = PD("msg","");
433 db_begin_write();
434 db_unprotect(PROTECT_READONLY);
 
435 chat_purge();
436 if( nByte==0 ){
437 if( zMsg[0] ){
438 db_multi_exec(
439 "INSERT INTO chat(mtime,lmtime,xfrom,xmsg)"
@@ -453,12 +451,12 @@
453 db_bind_blob(&q, ":file", &b);
454 db_step(&q);
455 db_finalize(&q);
456 blob_reset(&b);
457 }
458 db_protect_pop();
459 db_commit_transaction();
 
460 }
461
462 /*
463 ** This routine receives raw (user-entered) message text and
464 ** transforms it into HTML that is safe to insert using innerHTML. As
@@ -1265,11 +1263,11 @@
1265 #else
1266 zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl);
1267 #endif
1268 fossil_system(zCmd);
1269 }else if( strcmp(g.argv[2],"send")==0 ){
1270 const char *zFilename = find_option("file","r",1);
1271 const char *zAs = find_option("as",0,1);
1272 const char *zMsg = find_option("message","m",1);
1273 int allowUnsafe = find_option("unsafe",0,0)!=0;
1274 const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
1275 int i;
1276
--- src/chat.c
+++ src/chat.c
@@ -422,18 +422,16 @@
422 login_check_credentials();
423 if( 0==g.perm.Chat ) {
424 chat_emit_permissions_error(0);
425 return;
426 }
 
 
 
427 zUserName = (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody";
428 nByte = atoi(PD("file:bytes","0"));
429 zMsg = PD("msg","");
430 db_begin_write();
431 db_unprotect(PROTECT_READONLY);
432 chat_create_tables();
433 chat_purge();
434 if( nByte==0 ){
435 if( zMsg[0] ){
436 db_multi_exec(
437 "INSERT INTO chat(mtime,lmtime,xfrom,xmsg)"
@@ -453,12 +451,12 @@
451 db_bind_blob(&q, ":file", &b);
452 db_step(&q);
453 db_finalize(&q);
454 blob_reset(&b);
455 }
 
456 db_commit_transaction();
457 db_protect_pop();
458 }
459
460 /*
461 ** This routine receives raw (user-entered) message text and
462 ** transforms it into HTML that is safe to insert using innerHTML. As
@@ -1265,11 +1263,11 @@
1263 #else
1264 zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl);
1265 #endif
1266 fossil_system(zCmd);
1267 }else if( strcmp(g.argv[2],"send")==0 ){
1268 const char *zFilename = find_option("file","f",1);
1269 const char *zAs = find_option("as",0,1);
1270 const char *zMsg = find_option("message","m",1);
1271 int allowUnsafe = find_option("unsafe",0,0)!=0;
1272 const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
1273 int i;
1274

Keyboard Shortcuts

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