Fossil SCM
Fix misinteraction of the chat send command and the chat search index.
Commit
892dfd2b5510d628c5cfe6c804117fb447952c54882f1a9fb536d84ae84f2f85
Parent
a913716b4c40cbb…
1 file changed
+3
-5
+3
-5
| --- src/chat.c | ||
| +++ src/chat.c | ||
| @@ -422,18 +422,16 @@ | ||
| 422 | 422 | login_check_credentials(); |
| 423 | 423 | if( 0==g.perm.Chat ) { |
| 424 | 424 | chat_emit_permissions_error(0); |
| 425 | 425 | return; |
| 426 | 426 | } |
| 427 | - if( !db_table_exists("repository","chat") ){ | |
| 428 | - return; | |
| 429 | - } | |
| 430 | 427 | zUserName = (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody"; |
| 431 | 428 | nByte = atoi(PD("file:bytes","0")); |
| 432 | 429 | zMsg = PD("msg",""); |
| 433 | 430 | db_begin_write(); |
| 434 | 431 | db_unprotect(PROTECT_READONLY); |
| 432 | + chat_create_tables(); | |
| 435 | 433 | chat_purge(); |
| 436 | 434 | if( nByte==0 ){ |
| 437 | 435 | if( zMsg[0] ){ |
| 438 | 436 | db_multi_exec( |
| 439 | 437 | "INSERT INTO chat(mtime,lmtime,xfrom,xmsg)" |
| @@ -453,12 +451,12 @@ | ||
| 453 | 451 | db_bind_blob(&q, ":file", &b); |
| 454 | 452 | db_step(&q); |
| 455 | 453 | db_finalize(&q); |
| 456 | 454 | blob_reset(&b); |
| 457 | 455 | } |
| 458 | - db_protect_pop(); | |
| 459 | 456 | db_commit_transaction(); |
| 457 | + db_protect_pop(); | |
| 460 | 458 | } |
| 461 | 459 | |
| 462 | 460 | /* |
| 463 | 461 | ** This routine receives raw (user-entered) message text and |
| 464 | 462 | ** transforms it into HTML that is safe to insert using innerHTML. As |
| @@ -1265,11 +1263,11 @@ | ||
| 1265 | 1263 | #else |
| 1266 | 1264 | zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl); |
| 1267 | 1265 | #endif |
| 1268 | 1266 | fossil_system(zCmd); |
| 1269 | 1267 | }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); | |
| 1271 | 1269 | const char *zAs = find_option("as",0,1); |
| 1272 | 1270 | const char *zMsg = find_option("message","m",1); |
| 1273 | 1271 | int allowUnsafe = find_option("unsafe",0,0)!=0; |
| 1274 | 1272 | const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS; |
| 1275 | 1273 | int i; |
| 1276 | 1274 |
| --- 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 |