Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fix the /chat-poll page so that it works even when called from "fossil ui". |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | chatroom-dev |
| Files: | files | file ages | folders |
| SHA3-256: |
6f424a32b5ef1ddbc086dba562ff7e2f |
| User & Date: | drh 2020-12-23 18:21:38.699 |
Context
|
2020-12-23
| ||
| 18:27 | Merge the development of the Fossil chatroom onto trunk. This feature is well isolated from the rest of the system and so we can safely continue development on trunk, which is more convenient for testing. ... (check-in: e8ba89b168 user: drh tags: trunk) | |
| 18:21 | Fix the /chat-poll page so that it works even when called from "fossil ui". ... (Closed-Leaf check-in: 6f424a32b5 user: drh tags: chatroom-dev) | |
| 16:19 | Additional documentation on the /chat-poll page. ... (check-in: 2261b29415 user: drh tags: chatroom-dev) | |
Changes
Changes to src/chat.c.
| ︙ | ︙ | |||
261 262 263 264 265 266 267 |
** The "msgid" values will be in increasing order.
**
** The "mdel" will only exist if "xmsg" is an empty string and "fsize" is zero.
*/
void chat_poll_webpage(void){
Blob json; /* The json to be constructed and returned */
sqlite3_int64 dataVersion; /* Data version. Used for polling. */
| < | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
** The "msgid" values will be in increasing order.
**
** The "mdel" will only exist if "xmsg" is an empty string and "fsize" is zero.
*/
void chat_poll_webpage(void){
Blob json; /* The json to be constructed and returned */
sqlite3_int64 dataVersion; /* Data version. Used for polling. */
int iDelay = 1000; /* Delay until next poll (milliseconds) */
const char *zSep = "{\"msgs\":[\n"; /* List separator */
int msgid = atoi(PD("name","0"));
Stmt q1;
login_check_credentials();
if( !g.perm.Chat ) return;
chat_create_tables();
|
| ︙ | ︙ | |||
323 324 325 326 327 328 329 330 331 332 333 334 335 |
}
if( iToDel ){
blob_appendf(&json, ",\"mdel\":%d}", iToDel);
}else{
blob_append(&json, "}", 1);
}
}
if( cnt ){
blob_append(&json, "\n]}", 3);
cgi_set_content(&json);
break;
}
sqlite3_sleep(iDelay);
| > > | > > > > < | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
}
if( iToDel ){
blob_appendf(&json, ",\"mdel\":%d}", iToDel);
}else{
blob_append(&json, "}", 1);
}
}
db_reset(&q1);
if( cnt ){
blob_append(&json, "\n]}", 3);
cgi_set_content(&json);
break;
}
sqlite3_sleep(iDelay);
while( 1 ){
sqlite3_int64 newDataVers = db_int64(0,"PRAGMA repository.data_version");
if( newDataVers!=dataVersion ){
dataVersion = newDataVers;
break;
}
sqlite3_sleep(iDelay);
}
} /* Exit by "break" */
db_finalize(&q1);
return;
}
/*
** WEBPAGE: chat-download
|
| ︙ | ︙ |