Fossil SCM
/chat-send now uses the user name 'nobody' for guest-user posts. See [forum:/forumpost/e0be0eeb4c | forum post e0be0eeb4c] for details.
Commit
5312f3738e713608a0b5a91e2537e80a175a6d7f0d24029c9af17adc0a3f88cb
Parent
92b5cc21ce90053…
1 file changed
+4
-2
+4
-2
| --- src/chat.c | ||
| +++ src/chat.c | ||
| @@ -305,35 +305,37 @@ | ||
| 305 | 305 | ** list of objects. |
| 306 | 306 | */ |
| 307 | 307 | void chat_send_webpage(void){ |
| 308 | 308 | int nByte; |
| 309 | 309 | const char *zMsg; |
| 310 | + const char *zUserName; | |
| 310 | 311 | login_check_credentials(); |
| 311 | 312 | if( !g.perm.Chat ) { |
| 312 | 313 | chat_emit_permissions_error(0); |
| 313 | 314 | return; |
| 314 | 315 | } |
| 315 | 316 | chat_create_tables(); |
| 317 | + zUserName = (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody"; | |
| 316 | 318 | nByte = atoi(PD("file:bytes","0")); |
| 317 | 319 | zMsg = PD("msg",""); |
| 318 | 320 | db_begin_write(); |
| 319 | 321 | chat_purge(); |
| 320 | 322 | if( nByte==0 ){ |
| 321 | 323 | if( zMsg[0] ){ |
| 322 | 324 | db_multi_exec( |
| 323 | 325 | "INSERT INTO chat(mtime,lmtime,xfrom,xmsg)" |
| 324 | 326 | "VALUES(julianday('now'),%Q,%Q,%Q)", |
| 325 | - P("lmtime"), g.zLogin, zMsg | |
| 327 | + P("lmtime"), zUserName, zMsg | |
| 326 | 328 | ); |
| 327 | 329 | } |
| 328 | 330 | }else{ |
| 329 | 331 | Stmt q; |
| 330 | 332 | Blob b; |
| 331 | 333 | db_prepare(&q, |
| 332 | 334 | "INSERT INTO chat(mtime,lmtime,xfrom,xmsg,file,fname,fmime)" |
| 333 | 335 | "VALUES(julianday('now'),%Q,%Q,%Q,:file,%Q,%Q)", |
| 334 | - P("lmtime"), g.zLogin, zMsg, PD("file:filename",""), | |
| 336 | + P("lmtime"), zUserName, zMsg, PD("file:filename",""), | |
| 335 | 337 | PD("file:mimetype","application/octet-stream")); |
| 336 | 338 | blob_init(&b, P("file"), nByte); |
| 337 | 339 | db_bind_blob(&q, ":file", &b); |
| 338 | 340 | db_step(&q); |
| 339 | 341 | db_finalize(&q); |
| 340 | 342 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -305,35 +305,37 @@ | |
| 305 | ** list of objects. |
| 306 | */ |
| 307 | void chat_send_webpage(void){ |
| 308 | int nByte; |
| 309 | const char *zMsg; |
| 310 | login_check_credentials(); |
| 311 | if( !g.perm.Chat ) { |
| 312 | chat_emit_permissions_error(0); |
| 313 | return; |
| 314 | } |
| 315 | chat_create_tables(); |
| 316 | nByte = atoi(PD("file:bytes","0")); |
| 317 | zMsg = PD("msg",""); |
| 318 | db_begin_write(); |
| 319 | chat_purge(); |
| 320 | if( nByte==0 ){ |
| 321 | if( zMsg[0] ){ |
| 322 | db_multi_exec( |
| 323 | "INSERT INTO chat(mtime,lmtime,xfrom,xmsg)" |
| 324 | "VALUES(julianday('now'),%Q,%Q,%Q)", |
| 325 | P("lmtime"), g.zLogin, zMsg |
| 326 | ); |
| 327 | } |
| 328 | }else{ |
| 329 | Stmt q; |
| 330 | Blob b; |
| 331 | db_prepare(&q, |
| 332 | "INSERT INTO chat(mtime,lmtime,xfrom,xmsg,file,fname,fmime)" |
| 333 | "VALUES(julianday('now'),%Q,%Q,%Q,:file,%Q,%Q)", |
| 334 | P("lmtime"), g.zLogin, zMsg, PD("file:filename",""), |
| 335 | PD("file:mimetype","application/octet-stream")); |
| 336 | blob_init(&b, P("file"), nByte); |
| 337 | db_bind_blob(&q, ":file", &b); |
| 338 | db_step(&q); |
| 339 | db_finalize(&q); |
| 340 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -305,35 +305,37 @@ | |
| 305 | ** list of objects. |
| 306 | */ |
| 307 | void chat_send_webpage(void){ |
| 308 | int nByte; |
| 309 | const char *zMsg; |
| 310 | const char *zUserName; |
| 311 | login_check_credentials(); |
| 312 | if( !g.perm.Chat ) { |
| 313 | chat_emit_permissions_error(0); |
| 314 | return; |
| 315 | } |
| 316 | chat_create_tables(); |
| 317 | zUserName = (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody"; |
| 318 | nByte = atoi(PD("file:bytes","0")); |
| 319 | zMsg = PD("msg",""); |
| 320 | db_begin_write(); |
| 321 | chat_purge(); |
| 322 | if( nByte==0 ){ |
| 323 | if( zMsg[0] ){ |
| 324 | db_multi_exec( |
| 325 | "INSERT INTO chat(mtime,lmtime,xfrom,xmsg)" |
| 326 | "VALUES(julianday('now'),%Q,%Q,%Q)", |
| 327 | P("lmtime"), zUserName, zMsg |
| 328 | ); |
| 329 | } |
| 330 | }else{ |
| 331 | Stmt q; |
| 332 | Blob b; |
| 333 | db_prepare(&q, |
| 334 | "INSERT INTO chat(mtime,lmtime,xfrom,xmsg,file,fname,fmime)" |
| 335 | "VALUES(julianday('now'),%Q,%Q,%Q,:file,%Q,%Q)", |
| 336 | P("lmtime"), zUserName, zMsg, PD("file:filename",""), |
| 337 | PD("file:mimetype","application/octet-stream")); |
| 338 | blob_init(&b, P("file"), nByte); |
| 339 | db_bind_blob(&q, ":file", &b); |
| 340 | db_step(&q); |
| 341 | db_finalize(&q); |
| 342 |