Fossil SCM
/chat: re-enable inclusion of unversioned sound files (mp3, wav, ogg) in the list of chat notification sounds.
Commit
2a59a9a15a6c5815bb0052bda86e91f228e3e74d2ad65a5589ba13c6adc56e2f
Parent
563ce12aca68c61…
1 file changed
+12
-18
+12
-18
| --- src/chat.c | ||
| +++ src/chat.c | ||
| @@ -47,11 +47,10 @@ | ||
| 47 | 47 | ** use by the chat front-end client. A handful of builtin files |
| 48 | 48 | ** (from alerts/\*.wav) and all unversioned files matching |
| 49 | 49 | ** alert-sounds/\*.{mp3,ogg,wav} are included. |
| 50 | 50 | */ |
| 51 | 51 | static void chat_emit_alert_list(void){ |
| 52 | - /*Stmt q = empty_Stmt;*/ | |
| 53 | 52 | unsigned int i; |
| 54 | 53 | const char * azBuiltins[] = { |
| 55 | 54 | "builtin/alerts/plunk.wav", |
| 56 | 55 | "builtin/alerts/bflat2.wav", |
| 57 | 56 | "builtin/alerts/bflat3.wav", |
| @@ -59,27 +58,22 @@ | ||
| 59 | 58 | }; |
| 60 | 59 | CX("window.fossil.config.chat.alerts = [\n"); |
| 61 | 60 | for(i=0; i < sizeof(azBuiltins)/sizeof(azBuiltins[0]); ++i){ |
| 62 | 61 | CX("%s%!j", i ? ", " : "", azBuiltins[i]); |
| 63 | 62 | } |
| 64 | -#if 0 | |
| 65 | - /* | |
| 66 | - ** 2021-01-05 temporarily disabled until we decide whether we're | |
| 67 | - ** going to keep configurable audio files or not. If we do, this | |
| 68 | - ** code needs to check whether the [unversioned] table exists before | |
| 69 | - ** querying it. | |
| 70 | - */ | |
| 71 | - db_prepare(&q, "SELECT 'uv/'||name FROM unversioned " | |
| 72 | - "WHERE content IS NOT NULL " | |
| 73 | - "AND (name LIKE 'alert-sounds/%%.wav' " | |
| 74 | - "OR name LIKE 'alert-sounds/%%.mp3' " | |
| 75 | - "OR name LIKE 'alert-sounds/%%.ogg')"); | |
| 76 | - while(SQLITE_ROW==db_step(&q)){ | |
| 77 | - CX(", %!j", db_column_text(&q, 0)); | |
| 78 | - } | |
| 79 | - db_finalize(&q); | |
| 80 | -#endif | |
| 63 | + if( db_table_exists("repository","unversioned") ){ | |
| 64 | + Stmt q = empty_Stmt; | |
| 65 | + db_prepare(&q, "SELECT 'uv/'||name FROM unversioned " | |
| 66 | + "WHERE content IS NOT NULL " | |
| 67 | + "AND (name LIKE 'alert-sounds/%%.wav' " | |
| 68 | + "OR name LIKE 'alert-sounds/%%.mp3' " | |
| 69 | + "OR name LIKE 'alert-sounds/%%.ogg')"); | |
| 70 | + while(SQLITE_ROW==db_step(&q)){ | |
| 71 | + CX(", %!j", db_column_text(&q, 0)); | |
| 72 | + } | |
| 73 | + db_finalize(&q); | |
| 74 | + } | |
| 81 | 75 | CX("\n];\n"); |
| 82 | 76 | } |
| 83 | 77 | |
| 84 | 78 | /* Settings that can be used to control chat */ |
| 85 | 79 | /* |
| 86 | 80 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -47,11 +47,10 @@ | |
| 47 | ** use by the chat front-end client. A handful of builtin files |
| 48 | ** (from alerts/\*.wav) and all unversioned files matching |
| 49 | ** alert-sounds/\*.{mp3,ogg,wav} are included. |
| 50 | */ |
| 51 | static void chat_emit_alert_list(void){ |
| 52 | /*Stmt q = empty_Stmt;*/ |
| 53 | unsigned int i; |
| 54 | const char * azBuiltins[] = { |
| 55 | "builtin/alerts/plunk.wav", |
| 56 | "builtin/alerts/bflat2.wav", |
| 57 | "builtin/alerts/bflat3.wav", |
| @@ -59,27 +58,22 @@ | |
| 59 | }; |
| 60 | CX("window.fossil.config.chat.alerts = [\n"); |
| 61 | for(i=0; i < sizeof(azBuiltins)/sizeof(azBuiltins[0]); ++i){ |
| 62 | CX("%s%!j", i ? ", " : "", azBuiltins[i]); |
| 63 | } |
| 64 | #if 0 |
| 65 | /* |
| 66 | ** 2021-01-05 temporarily disabled until we decide whether we're |
| 67 | ** going to keep configurable audio files or not. If we do, this |
| 68 | ** code needs to check whether the [unversioned] table exists before |
| 69 | ** querying it. |
| 70 | */ |
| 71 | db_prepare(&q, "SELECT 'uv/'||name FROM unversioned " |
| 72 | "WHERE content IS NOT NULL " |
| 73 | "AND (name LIKE 'alert-sounds/%%.wav' " |
| 74 | "OR name LIKE 'alert-sounds/%%.mp3' " |
| 75 | "OR name LIKE 'alert-sounds/%%.ogg')"); |
| 76 | while(SQLITE_ROW==db_step(&q)){ |
| 77 | CX(", %!j", db_column_text(&q, 0)); |
| 78 | } |
| 79 | db_finalize(&q); |
| 80 | #endif |
| 81 | CX("\n];\n"); |
| 82 | } |
| 83 | |
| 84 | /* Settings that can be used to control chat */ |
| 85 | /* |
| 86 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -47,11 +47,10 @@ | |
| 47 | ** use by the chat front-end client. A handful of builtin files |
| 48 | ** (from alerts/\*.wav) and all unversioned files matching |
| 49 | ** alert-sounds/\*.{mp3,ogg,wav} are included. |
| 50 | */ |
| 51 | static void chat_emit_alert_list(void){ |
| 52 | unsigned int i; |
| 53 | const char * azBuiltins[] = { |
| 54 | "builtin/alerts/plunk.wav", |
| 55 | "builtin/alerts/bflat2.wav", |
| 56 | "builtin/alerts/bflat3.wav", |
| @@ -59,27 +58,22 @@ | |
| 58 | }; |
| 59 | CX("window.fossil.config.chat.alerts = [\n"); |
| 60 | for(i=0; i < sizeof(azBuiltins)/sizeof(azBuiltins[0]); ++i){ |
| 61 | CX("%s%!j", i ? ", " : "", azBuiltins[i]); |
| 62 | } |
| 63 | if( db_table_exists("repository","unversioned") ){ |
| 64 | Stmt q = empty_Stmt; |
| 65 | db_prepare(&q, "SELECT 'uv/'||name FROM unversioned " |
| 66 | "WHERE content IS NOT NULL " |
| 67 | "AND (name LIKE 'alert-sounds/%%.wav' " |
| 68 | "OR name LIKE 'alert-sounds/%%.mp3' " |
| 69 | "OR name LIKE 'alert-sounds/%%.ogg')"); |
| 70 | while(SQLITE_ROW==db_step(&q)){ |
| 71 | CX(", %!j", db_column_text(&q, 0)); |
| 72 | } |
| 73 | db_finalize(&q); |
| 74 | } |
| 75 | CX("\n];\n"); |
| 76 | } |
| 77 | |
| 78 | /* Settings that can be used to control chat */ |
| 79 | /* |
| 80 |