Fossil SCM
Provide for two different chat-alert sounds in the /Admin/Chat configuration menu.
Commit
d8e6994350396da1a6cf0749b8a87fdcf3076966511821a7baf80c0038896b77
Parent
1e008989496a5aa…
8 files changed
+8
-2
+1
-1
+1
-1
+15
-2
+1
-1
+2
-2
D
src/alerts/b-flat.wav
Binary file
Binary file
+8
-2
| --- src/chat.c | ||
| +++ src/chat.c | ||
| @@ -125,10 +125,16 @@ | ||
| 125 | 125 | ** server environments may choose a longer or shorter delay. |
| 126 | 126 | ** |
| 127 | 127 | ** For maximum efficiency, it is best to choose the longest delay that |
| 128 | 128 | ** does not cause timeouts in intermediate proxies or web server. |
| 129 | 129 | */ |
| 130 | +/* | |
| 131 | +** SETTING: chat-alert-sound width=10 | |
| 132 | +** | |
| 133 | +** This is the name of the builtin sound file to use for the alert tone. | |
| 134 | +** The value must be the name of one of a builtin WAV file. | |
| 135 | +*/ | |
| 130 | 136 | /* |
| 131 | 137 | ** WEBPAGE: chat |
| 132 | 138 | ** |
| 133 | 139 | ** Start up a browser-based chat session. |
| 134 | 140 | ** |
| @@ -705,12 +711,12 @@ | ||
| 705 | 711 | ** arrives. |
| 706 | 712 | */ |
| 707 | 713 | void chat_audio_alert(void){ |
| 708 | 714 | Blob audio = empty_blob; |
| 709 | 715 | int n = 0; |
| 710 | - const char * zAudio = | |
| 711 | - (const char *)builtin_file("sounds/plunk.wav", &n); | |
| 716 | + const char *zName = db_get("chat-alert-sound", "alerts/plunk.wav"); | |
| 717 | + const char *zAudio = (const char*)builtin_file(zName, &n); | |
| 712 | 718 | blob_init(&audio, zAudio, n); |
| 713 | 719 | cgi_set_content_type("audio/wav"); |
| 714 | 720 | cgi_set_content(&audio); |
| 715 | 721 | } |
| 716 | 722 | |
| 717 | 723 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -125,10 +125,16 @@ | |
| 125 | ** server environments may choose a longer or shorter delay. |
| 126 | ** |
| 127 | ** For maximum efficiency, it is best to choose the longest delay that |
| 128 | ** does not cause timeouts in intermediate proxies or web server. |
| 129 | */ |
| 130 | /* |
| 131 | ** WEBPAGE: chat |
| 132 | ** |
| 133 | ** Start up a browser-based chat session. |
| 134 | ** |
| @@ -705,12 +711,12 @@ | |
| 705 | ** arrives. |
| 706 | */ |
| 707 | void chat_audio_alert(void){ |
| 708 | Blob audio = empty_blob; |
| 709 | int n = 0; |
| 710 | const char * zAudio = |
| 711 | (const char *)builtin_file("sounds/plunk.wav", &n); |
| 712 | blob_init(&audio, zAudio, n); |
| 713 | cgi_set_content_type("audio/wav"); |
| 714 | cgi_set_content(&audio); |
| 715 | } |
| 716 | |
| 717 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -125,10 +125,16 @@ | |
| 125 | ** server environments may choose a longer or shorter delay. |
| 126 | ** |
| 127 | ** For maximum efficiency, it is best to choose the longest delay that |
| 128 | ** does not cause timeouts in intermediate proxies or web server. |
| 129 | */ |
| 130 | /* |
| 131 | ** SETTING: chat-alert-sound width=10 |
| 132 | ** |
| 133 | ** This is the name of the builtin sound file to use for the alert tone. |
| 134 | ** The value must be the name of one of a builtin WAV file. |
| 135 | */ |
| 136 | /* |
| 137 | ** WEBPAGE: chat |
| 138 | ** |
| 139 | ** Start up a browser-based chat session. |
| 140 | ** |
| @@ -705,12 +711,12 @@ | |
| 711 | ** arrives. |
| 712 | */ |
| 713 | void chat_audio_alert(void){ |
| 714 | Blob audio = empty_blob; |
| 715 | int n = 0; |
| 716 | const char *zName = db_get("chat-alert-sound", "alerts/plunk.wav"); |
| 717 | const char *zAudio = (const char*)builtin_file(zName, &n); |
| 718 | blob_init(&audio, zAudio, n); |
| 719 | cgi_set_content_type("audio/wav"); |
| 720 | cgi_set_content(&audio); |
| 721 | } |
| 722 | |
| 723 |
+1
-1
| --- src/chat.js | ||
| +++ src/chat.js | ||
| @@ -375,11 +375,11 @@ | ||
| 375 | 375 | setting is true, else this is a no-op. Returns this. |
| 376 | 376 | */ |
| 377 | 377 | playNewMessageSound: function f(){ |
| 378 | 378 | if(f.uri){ |
| 379 | 379 | try{ |
| 380 | - if(!f.audio) f.audio = new Audio(F.rootPath+f.uri); | |
| 380 | + if(!f.audio) f.audio = new Audio(F.rootPath+"chat-alert"); | |
| 381 | 381 | f.audio.currentTime = 0; |
| 382 | 382 | f.audio.play(); |
| 383 | 383 | }catch(e){ |
| 384 | 384 | console.error("Audio playblack failed.",e); |
| 385 | 385 | } |
| 386 | 386 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -375,11 +375,11 @@ | |
| 375 | setting is true, else this is a no-op. Returns this. |
| 376 | */ |
| 377 | playNewMessageSound: function f(){ |
| 378 | if(f.uri){ |
| 379 | try{ |
| 380 | if(!f.audio) f.audio = new Audio(F.rootPath+f.uri); |
| 381 | f.audio.currentTime = 0; |
| 382 | f.audio.play(); |
| 383 | }catch(e){ |
| 384 | console.error("Audio playblack failed.",e); |
| 385 | } |
| 386 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -375,11 +375,11 @@ | |
| 375 | setting is true, else this is a no-op. Returns this. |
| 376 | */ |
| 377 | playNewMessageSound: function f(){ |
| 378 | if(f.uri){ |
| 379 | try{ |
| 380 | if(!f.audio) f.audio = new Audio(F.rootPath+"chat-alert"); |
| 381 | f.audio.currentTime = 0; |
| 382 | f.audio.play(); |
| 383 | }catch(e){ |
| 384 | console.error("Audio playblack failed.",e); |
| 385 | } |
| 386 |
+1
-1
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -220,11 +220,11 @@ | ||
| 220 | 220 | $(SRCDIR)/../skins/xekri/css.txt \ |
| 221 | 221 | $(SRCDIR)/../skins/xekri/details.txt \ |
| 222 | 222 | $(SRCDIR)/../skins/xekri/footer.txt \ |
| 223 | 223 | $(SRCDIR)/../skins/xekri/header.txt \ |
| 224 | 224 | $(SRCDIR)/accordion.js \ |
| 225 | - $(SRCDIR)/alerts/b-flat.wav \ | |
| 225 | + $(SRCDIR)/alerts/bflat3.wav \ | |
| 226 | 226 | $(SRCDIR)/alerts/plunk.wav \ |
| 227 | 227 | $(SRCDIR)/chat.js \ |
| 228 | 228 | $(SRCDIR)/ci_edit.js \ |
| 229 | 229 | $(SRCDIR)/copybtn.js \ |
| 230 | 230 | $(SRCDIR)/default.css \ |
| 231 | 231 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -220,11 +220,11 @@ | |
| 220 | $(SRCDIR)/../skins/xekri/css.txt \ |
| 221 | $(SRCDIR)/../skins/xekri/details.txt \ |
| 222 | $(SRCDIR)/../skins/xekri/footer.txt \ |
| 223 | $(SRCDIR)/../skins/xekri/header.txt \ |
| 224 | $(SRCDIR)/accordion.js \ |
| 225 | $(SRCDIR)/alerts/b-flat.wav \ |
| 226 | $(SRCDIR)/alerts/plunk.wav \ |
| 227 | $(SRCDIR)/chat.js \ |
| 228 | $(SRCDIR)/ci_edit.js \ |
| 229 | $(SRCDIR)/copybtn.js \ |
| 230 | $(SRCDIR)/default.css \ |
| 231 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -220,11 +220,11 @@ | |
| 220 | $(SRCDIR)/../skins/xekri/css.txt \ |
| 221 | $(SRCDIR)/../skins/xekri/details.txt \ |
| 222 | $(SRCDIR)/../skins/xekri/footer.txt \ |
| 223 | $(SRCDIR)/../skins/xekri/header.txt \ |
| 224 | $(SRCDIR)/accordion.js \ |
| 225 | $(SRCDIR)/alerts/bflat3.wav \ |
| 226 | $(SRCDIR)/alerts/plunk.wav \ |
| 227 | $(SRCDIR)/chat.js \ |
| 228 | $(SRCDIR)/ci_edit.js \ |
| 229 | $(SRCDIR)/copybtn.js \ |
| 230 | $(SRCDIR)/default.css \ |
| 231 |
+15
-2
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -1126,10 +1126,15 @@ | ||
| 1126 | 1126 | ** WEBPAGE: setup_chat |
| 1127 | 1127 | ** |
| 1128 | 1128 | ** The "Admin/Chat" page. Requires Setup privilege. |
| 1129 | 1129 | */ |
| 1130 | 1130 | void setup_chat(void){ |
| 1131 | + static const char *const azAlerts[] = { | |
| 1132 | + "alerts/plunk.wav", "Plunk", | |
| 1133 | + "alerts/bflat3.wav", "Tone-1", | |
| 1134 | + }; | |
| 1135 | + | |
| 1131 | 1136 | login_check_credentials(); |
| 1132 | 1137 | if( !g.perm.Setup ){ |
| 1133 | 1138 | login_needed(0); |
| 1134 | 1139 | return; |
| 1135 | 1140 | } |
| @@ -1170,12 +1175,20 @@ | ||
| 1170 | 1175 | @ determines how long /chat-poll will wait before giving up. The |
| 1171 | 1176 | @ default setting of approximately 7 minutes works well on many systems. |
| 1172 | 1177 | @ Shorter delays might be required on installations that use proxies |
| 1173 | 1178 | @ or web-servers with short timeouts. For best efficiency, this value |
| 1174 | 1179 | @ should be larger rather than smaller. |
| 1175 | - @ (Property: "chat-chat-timeout")</p> | |
| 1176 | - @ </hr> | |
| 1180 | + @ (Property: "chat-poll-timeout")</p> | |
| 1181 | + @ <hr /> | |
| 1182 | + | |
| 1183 | + multiple_choice_attribute("Alert sound", | |
| 1184 | + "chat-alert-sound", "snd", azAlerts[0], | |
| 1185 | + count(azAlerts)/2, azAlerts); | |
| 1186 | + @ <p>The sound used in the client-side chat to indicate that a new | |
| 1187 | + @ chat message has arrived. | |
| 1188 | + @ (Property: "chat-alert-sound")</p> | |
| 1189 | + @ <hr/> | |
| 1177 | 1190 | @ <p><input type="submit" name="submit" value="Apply Changes" /></p> |
| 1178 | 1191 | @ </div></form> |
| 1179 | 1192 | db_end_transaction(0); |
| 1180 | 1193 | style_finish_page(); |
| 1181 | 1194 | } |
| 1182 | 1195 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1126,10 +1126,15 @@ | |
| 1126 | ** WEBPAGE: setup_chat |
| 1127 | ** |
| 1128 | ** The "Admin/Chat" page. Requires Setup privilege. |
| 1129 | */ |
| 1130 | void setup_chat(void){ |
| 1131 | login_check_credentials(); |
| 1132 | if( !g.perm.Setup ){ |
| 1133 | login_needed(0); |
| 1134 | return; |
| 1135 | } |
| @@ -1170,12 +1175,20 @@ | |
| 1170 | @ determines how long /chat-poll will wait before giving up. The |
| 1171 | @ default setting of approximately 7 minutes works well on many systems. |
| 1172 | @ Shorter delays might be required on installations that use proxies |
| 1173 | @ or web-servers with short timeouts. For best efficiency, this value |
| 1174 | @ should be larger rather than smaller. |
| 1175 | @ (Property: "chat-chat-timeout")</p> |
| 1176 | @ </hr> |
| 1177 | @ <p><input type="submit" name="submit" value="Apply Changes" /></p> |
| 1178 | @ </div></form> |
| 1179 | db_end_transaction(0); |
| 1180 | style_finish_page(); |
| 1181 | } |
| 1182 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1126,10 +1126,15 @@ | |
| 1126 | ** WEBPAGE: setup_chat |
| 1127 | ** |
| 1128 | ** The "Admin/Chat" page. Requires Setup privilege. |
| 1129 | */ |
| 1130 | void setup_chat(void){ |
| 1131 | static const char *const azAlerts[] = { |
| 1132 | "alerts/plunk.wav", "Plunk", |
| 1133 | "alerts/bflat3.wav", "Tone-1", |
| 1134 | }; |
| 1135 | |
| 1136 | login_check_credentials(); |
| 1137 | if( !g.perm.Setup ){ |
| 1138 | login_needed(0); |
| 1139 | return; |
| 1140 | } |
| @@ -1170,12 +1175,20 @@ | |
| 1175 | @ determines how long /chat-poll will wait before giving up. The |
| 1176 | @ default setting of approximately 7 minutes works well on many systems. |
| 1177 | @ Shorter delays might be required on installations that use proxies |
| 1178 | @ or web-servers with short timeouts. For best efficiency, this value |
| 1179 | @ should be larger rather than smaller. |
| 1180 | @ (Property: "chat-poll-timeout")</p> |
| 1181 | @ <hr /> |
| 1182 | |
| 1183 | multiple_choice_attribute("Alert sound", |
| 1184 | "chat-alert-sound", "snd", azAlerts[0], |
| 1185 | count(azAlerts)/2, azAlerts); |
| 1186 | @ <p>The sound used in the client-side chat to indicate that a new |
| 1187 | @ chat message has arrived. |
| 1188 | @ (Property: "chat-alert-sound")</p> |
| 1189 | @ <hr/> |
| 1190 | @ <p><input type="submit" name="submit" value="Apply Changes" /></p> |
| 1191 | @ </div></form> |
| 1192 | db_end_transaction(0); |
| 1193 | style_finish_page(); |
| 1194 | } |
| 1195 |
+1
-1
| --- win/Makefile.mingw | ||
| +++ win/Makefile.mingw | ||
| @@ -632,11 +632,11 @@ | ||
| 632 | 632 | $(SRCDIR)/../skins/xekri/css.txt \ |
| 633 | 633 | $(SRCDIR)/../skins/xekri/details.txt \ |
| 634 | 634 | $(SRCDIR)/../skins/xekri/footer.txt \ |
| 635 | 635 | $(SRCDIR)/../skins/xekri/header.txt \ |
| 636 | 636 | $(SRCDIR)/accordion.js \ |
| 637 | - $(SRCDIR)/alerts/b-flat.wav \ | |
| 637 | + $(SRCDIR)/alerts/bflat3.wav \ | |
| 638 | 638 | $(SRCDIR)/alerts/plunk.wav \ |
| 639 | 639 | $(SRCDIR)/chat.js \ |
| 640 | 640 | $(SRCDIR)/ci_edit.js \ |
| 641 | 641 | $(SRCDIR)/copybtn.js \ |
| 642 | 642 | $(SRCDIR)/default.css \ |
| 643 | 643 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -632,11 +632,11 @@ | |
| 632 | $(SRCDIR)/../skins/xekri/css.txt \ |
| 633 | $(SRCDIR)/../skins/xekri/details.txt \ |
| 634 | $(SRCDIR)/../skins/xekri/footer.txt \ |
| 635 | $(SRCDIR)/../skins/xekri/header.txt \ |
| 636 | $(SRCDIR)/accordion.js \ |
| 637 | $(SRCDIR)/alerts/b-flat.wav \ |
| 638 | $(SRCDIR)/alerts/plunk.wav \ |
| 639 | $(SRCDIR)/chat.js \ |
| 640 | $(SRCDIR)/ci_edit.js \ |
| 641 | $(SRCDIR)/copybtn.js \ |
| 642 | $(SRCDIR)/default.css \ |
| 643 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -632,11 +632,11 @@ | |
| 632 | $(SRCDIR)/../skins/xekri/css.txt \ |
| 633 | $(SRCDIR)/../skins/xekri/details.txt \ |
| 634 | $(SRCDIR)/../skins/xekri/footer.txt \ |
| 635 | $(SRCDIR)/../skins/xekri/header.txt \ |
| 636 | $(SRCDIR)/accordion.js \ |
| 637 | $(SRCDIR)/alerts/bflat3.wav \ |
| 638 | $(SRCDIR)/alerts/plunk.wav \ |
| 639 | $(SRCDIR)/chat.js \ |
| 640 | $(SRCDIR)/ci_edit.js \ |
| 641 | $(SRCDIR)/copybtn.js \ |
| 642 | $(SRCDIR)/default.css \ |
| 643 |
+2
-2
| --- win/Makefile.msc | ||
| +++ win/Makefile.msc | ||
| @@ -553,11 +553,11 @@ | ||
| 553 | 553 | "$(SRCDIR)\..\skins\xekri\css.txt" \ |
| 554 | 554 | "$(SRCDIR)\..\skins\xekri\details.txt" \ |
| 555 | 555 | "$(SRCDIR)\..\skins\xekri\footer.txt" \ |
| 556 | 556 | "$(SRCDIR)\..\skins\xekri\header.txt" \ |
| 557 | 557 | "$(SRCDIR)\accordion.js" \ |
| 558 | - "$(SRCDIR)\alerts\b-flat.wav" \ | |
| 558 | + "$(SRCDIR)\alerts\bflat3.wav" \ | |
| 559 | 559 | "$(SRCDIR)\alerts\plunk.wav" \ |
| 560 | 560 | "$(SRCDIR)\chat.js" \ |
| 561 | 561 | "$(SRCDIR)\ci_edit.js" \ |
| 562 | 562 | "$(SRCDIR)\copybtn.js" \ |
| 563 | 563 | "$(SRCDIR)\default.css" \ |
| @@ -1164,11 +1164,11 @@ | ||
| 1164 | 1164 | echo "$(SRCDIR)\../skins/xekri/css.txt" >> $@ |
| 1165 | 1165 | echo "$(SRCDIR)\../skins/xekri/details.txt" >> $@ |
| 1166 | 1166 | echo "$(SRCDIR)\../skins/xekri/footer.txt" >> $@ |
| 1167 | 1167 | echo "$(SRCDIR)\../skins/xekri/header.txt" >> $@ |
| 1168 | 1168 | echo "$(SRCDIR)\accordion.js" >> $@ |
| 1169 | - echo "$(SRCDIR)\alerts/b-flat.wav" >> $@ | |
| 1169 | + echo "$(SRCDIR)\alerts/bflat3.wav" >> $@ | |
| 1170 | 1170 | echo "$(SRCDIR)\alerts/plunk.wav" >> $@ |
| 1171 | 1171 | echo "$(SRCDIR)\chat.js" >> $@ |
| 1172 | 1172 | echo "$(SRCDIR)\ci_edit.js" >> $@ |
| 1173 | 1173 | echo "$(SRCDIR)\copybtn.js" >> $@ |
| 1174 | 1174 | echo "$(SRCDIR)\default.css" >> $@ |
| 1175 | 1175 |
| --- win/Makefile.msc | |
| +++ win/Makefile.msc | |
| @@ -553,11 +553,11 @@ | |
| 553 | "$(SRCDIR)\..\skins\xekri\css.txt" \ |
| 554 | "$(SRCDIR)\..\skins\xekri\details.txt" \ |
| 555 | "$(SRCDIR)\..\skins\xekri\footer.txt" \ |
| 556 | "$(SRCDIR)\..\skins\xekri\header.txt" \ |
| 557 | "$(SRCDIR)\accordion.js" \ |
| 558 | "$(SRCDIR)\alerts\b-flat.wav" \ |
| 559 | "$(SRCDIR)\alerts\plunk.wav" \ |
| 560 | "$(SRCDIR)\chat.js" \ |
| 561 | "$(SRCDIR)\ci_edit.js" \ |
| 562 | "$(SRCDIR)\copybtn.js" \ |
| 563 | "$(SRCDIR)\default.css" \ |
| @@ -1164,11 +1164,11 @@ | |
| 1164 | echo "$(SRCDIR)\../skins/xekri/css.txt" >> $@ |
| 1165 | echo "$(SRCDIR)\../skins/xekri/details.txt" >> $@ |
| 1166 | echo "$(SRCDIR)\../skins/xekri/footer.txt" >> $@ |
| 1167 | echo "$(SRCDIR)\../skins/xekri/header.txt" >> $@ |
| 1168 | echo "$(SRCDIR)\accordion.js" >> $@ |
| 1169 | echo "$(SRCDIR)\alerts/b-flat.wav" >> $@ |
| 1170 | echo "$(SRCDIR)\alerts/plunk.wav" >> $@ |
| 1171 | echo "$(SRCDIR)\chat.js" >> $@ |
| 1172 | echo "$(SRCDIR)\ci_edit.js" >> $@ |
| 1173 | echo "$(SRCDIR)\copybtn.js" >> $@ |
| 1174 | echo "$(SRCDIR)\default.css" >> $@ |
| 1175 |
| --- win/Makefile.msc | |
| +++ win/Makefile.msc | |
| @@ -553,11 +553,11 @@ | |
| 553 | "$(SRCDIR)\..\skins\xekri\css.txt" \ |
| 554 | "$(SRCDIR)\..\skins\xekri\details.txt" \ |
| 555 | "$(SRCDIR)\..\skins\xekri\footer.txt" \ |
| 556 | "$(SRCDIR)\..\skins\xekri\header.txt" \ |
| 557 | "$(SRCDIR)\accordion.js" \ |
| 558 | "$(SRCDIR)\alerts\bflat3.wav" \ |
| 559 | "$(SRCDIR)\alerts\plunk.wav" \ |
| 560 | "$(SRCDIR)\chat.js" \ |
| 561 | "$(SRCDIR)\ci_edit.js" \ |
| 562 | "$(SRCDIR)\copybtn.js" \ |
| 563 | "$(SRCDIR)\default.css" \ |
| @@ -1164,11 +1164,11 @@ | |
| 1164 | echo "$(SRCDIR)\../skins/xekri/css.txt" >> $@ |
| 1165 | echo "$(SRCDIR)\../skins/xekri/details.txt" >> $@ |
| 1166 | echo "$(SRCDIR)\../skins/xekri/footer.txt" >> $@ |
| 1167 | echo "$(SRCDIR)\../skins/xekri/header.txt" >> $@ |
| 1168 | echo "$(SRCDIR)\accordion.js" >> $@ |
| 1169 | echo "$(SRCDIR)\alerts/bflat3.wav" >> $@ |
| 1170 | echo "$(SRCDIR)\alerts/plunk.wav" >> $@ |
| 1171 | echo "$(SRCDIR)\chat.js" >> $@ |
| 1172 | echo "$(SRCDIR)\ci_edit.js" >> $@ |
| 1173 | echo "$(SRCDIR)\copybtn.js" >> $@ |
| 1174 | echo "$(SRCDIR)\default.css" >> $@ |
| 1175 |