Fossil SCM

/chat: re-enable inclusion of unversioned sound files (mp3, wav, ogg) in the list of chat notification sounds.

stephan 2021-09-18 02:36 chat-config-options
Commit 2a59a9a15a6c5815bb0052bda86e91f228e3e74d2ad65a5589ba13c6adc56e2f
1 file changed +12 -18
+12 -18
--- src/chat.c
+++ src/chat.c
@@ -47,11 +47,10 @@
4747
** use by the chat front-end client. A handful of builtin files
4848
** (from alerts/\*.wav) and all unversioned files matching
4949
** alert-sounds/\*.{mp3,ogg,wav} are included.
5050
*/
5151
static void chat_emit_alert_list(void){
52
- /*Stmt q = empty_Stmt;*/
5352
unsigned int i;
5453
const char * azBuiltins[] = {
5554
"builtin/alerts/plunk.wav",
5655
"builtin/alerts/bflat2.wav",
5756
"builtin/alerts/bflat3.wav",
@@ -59,27 +58,22 @@
5958
};
6059
CX("window.fossil.config.chat.alerts = [\n");
6160
for(i=0; i < sizeof(azBuiltins)/sizeof(azBuiltins[0]); ++i){
6261
CX("%s%!j", i ? ", " : "", azBuiltins[i]);
6362
}
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
+ }
8175
CX("\n];\n");
8276
}
8377
8478
/* Settings that can be used to control chat */
8579
/*
8680
--- 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

Keyboard Shortcuts

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