37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
** new content arrives. Newer Web Sockets and Server Sent Event protocols are
** more elegant, but are not compatible with CGI, and would thus complicate
** configuration.
*/
#include "config.h"
#include <assert.h>
#include "chat.h"
/*
** Outputs JS code to initialize a list of chat alert audio files for
** use by the chat front-end client. A handful of builtin files
** (from alerts/\*.wav) and all unversioned files matching
** alert-sounds/\*.{mp3,ogg,wav} are included.
*/
static void chat_emit_alert_list(void){
Stmt q = empty_Stmt;
unsigned int i;
const char * azBuiltins[] = {
"builtin/alerts/plunk.wav",
"builtin/alerts/b-flat.wav",
"builtin/alerts/g-minor-triad.wav"
};
CX("window.fossil.config.chat.alerts = [\n");
for(i=0; i < sizeof(azBuiltins)/sizeof(azBuiltins[0]); ++i){
CX("%s%!j", i ? ", " : "", azBuiltins[i]);
}
db_prepare(&q, "SELECT 'uv/'||name FROM unversioned "
"WHERE content IS NOT NULL "
"AND (name LIKE 'alert-sounds/%%.wav' "
"OR name LIKE 'alert-sounds/%%.mp3' "
"OR name LIKE 'alert-sounds/%%.ogg')");
while(SQLITE_ROW==db_step(&q)){
CX(", %!j", db_column_text(&q, 0));
}
db_finalize(&q);
CX("\n].sort();\n");
}
/* Settings that can be used to control chat */
/*
** SETTING: chat-initial-history width=10 default=50
**
** If this setting has an integer value of N, then when /chat first
** starts up it initializes the screen with the N most recent chat
|
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
+
|
@ document.body.classList.add('chat')
@ /*^^^for skins which add their own BODY tag */;
@ window.fossil.config.chat = {
@ fromcli: %h(PB("cli")?"true":"false"),
@ initSize: %d(db_get_int("chat-initial-history",50)),
@ imagesInline: !!%d(db_get_boolean("chat-inline-images",1))
@ };
chat_emit_alert_list();
cgi_append_content(builtin_text("chat.js"),-1);
@ }, false);
@ </script>
style_finish_page();
}
|