Fossil SCM

Do not require that the chat-timeline robot username be an actual user in the USER table. If the chat-timeline-user config variable exists, then timeline events are announced in chat, regardless.

drh 2022-09-14 19:24 trunk
Commit 1f5474ec319780d36a6b1c3098e53f0abd81f24ce4683f43490adf4776898434
3 files changed +1 -5 +1 -2 +5 -6
+1 -5
--- src/alerts.c
+++ src/alerts.c
@@ -160,14 +160,11 @@
160160
"END;"
161161
);
162162
}
163163
if( db_table_exists("repository","chat") ){
164164
const char *zChatUser = db_get("chat-timeline-user", 0);
165
- char *zChatCaps;
166
- if( zChatUser==0 || zChatUser[0]==0 ) return;
167
- zChatCaps = db_text(0, "SELECT cap FROM user WHERE login=%Q", zChatUser);
168
- if( zChatCaps && strchr(zChatCaps,'C')!=0 ){
165
+ if( zChatUser && zChatUser[0] ){
169166
db_multi_exec(
170167
"CREATE TRIGGER temp.chat_trigger1\n"
171168
"AFTER INSERT ON repository.event BEGIN\n"
172169
" INSERT INTO chat(mtime,xfrom,xmsg)"
173170
" SELECT julianday(), %Q,"
@@ -175,11 +172,10 @@
175172
" FROM blob WHERE rid=new.objid;\n"
176173
"END;\n",
177174
zChatUser
178175
);
179176
}
180
- fossil_free(zChatCaps);
181177
}
182178
}
183179
184180
/*
185181
** Disable triggers the event_pending and chat triggers.
186182
--- src/alerts.c
+++ src/alerts.c
@@ -160,14 +160,11 @@
160 "END;"
161 );
162 }
163 if( db_table_exists("repository","chat") ){
164 const char *zChatUser = db_get("chat-timeline-user", 0);
165 char *zChatCaps;
166 if( zChatUser==0 || zChatUser[0]==0 ) return;
167 zChatCaps = db_text(0, "SELECT cap FROM user WHERE login=%Q", zChatUser);
168 if( zChatCaps && strchr(zChatCaps,'C')!=0 ){
169 db_multi_exec(
170 "CREATE TRIGGER temp.chat_trigger1\n"
171 "AFTER INSERT ON repository.event BEGIN\n"
172 " INSERT INTO chat(mtime,xfrom,xmsg)"
173 " SELECT julianday(), %Q,"
@@ -175,11 +172,10 @@
175 " FROM blob WHERE rid=new.objid;\n"
176 "END;\n",
177 zChatUser
178 );
179 }
180 fossil_free(zChatCaps);
181 }
182 }
183
184 /*
185 ** Disable triggers the event_pending and chat triggers.
186
--- src/alerts.c
+++ src/alerts.c
@@ -160,14 +160,11 @@
160 "END;"
161 );
162 }
163 if( db_table_exists("repository","chat") ){
164 const char *zChatUser = db_get("chat-timeline-user", 0);
165 if( zChatUser && zChatUser[0] ){
 
 
 
166 db_multi_exec(
167 "CREATE TRIGGER temp.chat_trigger1\n"
168 "AFTER INSERT ON repository.event BEGIN\n"
169 " INSERT INTO chat(mtime,xfrom,xmsg)"
170 " SELECT julianday(), %Q,"
@@ -175,11 +172,10 @@
172 " FROM blob WHERE rid=new.objid;\n"
173 "END;\n",
174 zChatUser
175 );
176 }
 
177 }
178 }
179
180 /*
181 ** Disable triggers the event_pending and chat triggers.
182
+1 -2
--- src/chat.c
+++ src/chat.c
@@ -130,12 +130,11 @@
130130
** The value must be the name of a builtin WAV file.
131131
*/
132132
/*
133133
** SETTING: chat-timeline-user width=10
134134
**
135
-** If this setting is defined and is not an empty string and its value is
136
-** the name of a user that hash chat privilege (privilege letter "C"), then
135
+** If this setting is defined and is not an empty string, then
137136
** timeline events are posted to the chat as they arrive. The synthesized
138137
** chat messages appear to come from the user identified by this setting,
139138
** not the user on the timeline event.
140139
**
141140
** All chat messages that come from the chat-timeline-user are interpreted
142141
--- src/chat.c
+++ src/chat.c
@@ -130,12 +130,11 @@
130 ** The value must be the name of a builtin WAV file.
131 */
132 /*
133 ** SETTING: chat-timeline-user width=10
134 **
135 ** If this setting is defined and is not an empty string and its value is
136 ** the name of a user that hash chat privilege (privilege letter "C"), then
137 ** timeline events are posted to the chat as they arrive. The synthesized
138 ** chat messages appear to come from the user identified by this setting,
139 ** not the user on the timeline event.
140 **
141 ** All chat messages that come from the chat-timeline-user are interpreted
142
--- src/chat.c
+++ src/chat.c
@@ -130,12 +130,11 @@
130 ** The value must be the name of a builtin WAV file.
131 */
132 /*
133 ** SETTING: chat-timeline-user width=10
134 **
135 ** If this setting is defined and is not an empty string, then
 
136 ** timeline events are posted to the chat as they arrive. The synthesized
137 ** chat messages appear to come from the user identified by this setting,
138 ** not the user on the timeline event.
139 **
140 ** All chat messages that come from the chat-timeline-user are interpreted
141
+5 -6
--- src/setup.c
+++ src/setup.c
@@ -1353,16 +1353,15 @@
13531353
@ or web-servers with short timeouts. For best efficiency, this value
13541354
@ should be larger rather than smaller.
13551355
@ (Property: "chat-poll-timeout")</p>
13561356
@ <hr />
13571357
entry_attribute("Chat Timeline Robot Username", 15,
1358
- "chat-timeout-user", "chatrobot", "", 0);
1359
- @ <p>If this setting is the name of a user that has "C" privilege, then
1360
- @ all changes to the timeline will result in a new chat message from this
1361
- @ user. Leave this blank to omit notifications of check-ins and other
1362
- @ timeline events from appearing in chat.
1363
- @ (Property: "chat-timeout-user")</p>
1358
+ "chat-timeline-user", "chatrobot", "", 0);
1359
+ @ <p>If this setting is not an empty string, then any changes that appear
1360
+ @ on the timeline are announced in the chatroom under the username
1361
+ @ supplied. That user does not need to actually exist in the USER table.
1362
+ @ (Property: "chat-timeline-user")</p>
13641363
@ <hr />
13651364
13661365
multiple_choice_attribute("Alert sound",
13671366
"chat-alert-sound", "snd", azAlerts[0],
13681367
count(azAlerts)/2, azAlerts);
13691368
--- src/setup.c
+++ src/setup.c
@@ -1353,16 +1353,15 @@
1353 @ or web-servers with short timeouts. For best efficiency, this value
1354 @ should be larger rather than smaller.
1355 @ (Property: "chat-poll-timeout")</p>
1356 @ <hr />
1357 entry_attribute("Chat Timeline Robot Username", 15,
1358 "chat-timeout-user", "chatrobot", "", 0);
1359 @ <p>If this setting is the name of a user that has "C" privilege, then
1360 @ all changes to the timeline will result in a new chat message from this
1361 @ user. Leave this blank to omit notifications of check-ins and other
1362 @ timeline events from appearing in chat.
1363 @ (Property: "chat-timeout-user")</p>
1364 @ <hr />
1365
1366 multiple_choice_attribute("Alert sound",
1367 "chat-alert-sound", "snd", azAlerts[0],
1368 count(azAlerts)/2, azAlerts);
1369
--- src/setup.c
+++ src/setup.c
@@ -1353,16 +1353,15 @@
1353 @ or web-servers with short timeouts. For best efficiency, this value
1354 @ should be larger rather than smaller.
1355 @ (Property: "chat-poll-timeout")</p>
1356 @ <hr />
1357 entry_attribute("Chat Timeline Robot Username", 15,
1358 "chat-timeline-user", "chatrobot", "", 0);
1359 @ <p>If this setting is not an empty string, then any changes that appear
1360 @ on the timeline are announced in the chatroom under the username
1361 @ supplied. That user does not need to actually exist in the USER table.
1362 @ (Property: "chat-timeline-user")</p>
 
1363 @ <hr />
1364
1365 multiple_choice_attribute("Alert sound",
1366 "chat-alert-sound", "snd", azAlerts[0],
1367 count(azAlerts)/2, azAlerts);
1368

Keyboard Shortcuts

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