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.
Commit
1f5474ec319780d36a6b1c3098e53f0abd81f24ce4683f43490adf4776898434
Parent
e9d7cf3e92a3d11…
3 files changed
+1
-5
+1
-2
+5
-6
+1
-5
| --- src/alerts.c | ||
| +++ src/alerts.c | ||
| @@ -160,14 +160,11 @@ | ||
| 160 | 160 | "END;" |
| 161 | 161 | ); |
| 162 | 162 | } |
| 163 | 163 | if( db_table_exists("repository","chat") ){ |
| 164 | 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 ){ | |
| 165 | + if( zChatUser && zChatUser[0] ){ | |
| 169 | 166 | db_multi_exec( |
| 170 | 167 | "CREATE TRIGGER temp.chat_trigger1\n" |
| 171 | 168 | "AFTER INSERT ON repository.event BEGIN\n" |
| 172 | 169 | " INSERT INTO chat(mtime,xfrom,xmsg)" |
| 173 | 170 | " SELECT julianday(), %Q," |
| @@ -175,11 +172,10 @@ | ||
| 175 | 172 | " FROM blob WHERE rid=new.objid;\n" |
| 176 | 173 | "END;\n", |
| 177 | 174 | zChatUser |
| 178 | 175 | ); |
| 179 | 176 | } |
| 180 | - fossil_free(zChatCaps); | |
| 181 | 177 | } |
| 182 | 178 | } |
| 183 | 179 | |
| 184 | 180 | /* |
| 185 | 181 | ** Disable triggers the event_pending and chat triggers. |
| 186 | 182 |
| --- 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 @@ | ||
| 130 | 130 | ** The value must be the name of a builtin WAV file. |
| 131 | 131 | */ |
| 132 | 132 | /* |
| 133 | 133 | ** SETTING: chat-timeline-user width=10 |
| 134 | 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 | |
| 135 | +** If this setting is defined and is not an empty string, then | |
| 137 | 136 | ** timeline events are posted to the chat as they arrive. The synthesized |
| 138 | 137 | ** chat messages appear to come from the user identified by this setting, |
| 139 | 138 | ** not the user on the timeline event. |
| 140 | 139 | ** |
| 141 | 140 | ** All chat messages that come from the chat-timeline-user are interpreted |
| 142 | 141 |
| --- 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 @@ | ||
| 1353 | 1353 | @ or web-servers with short timeouts. For best efficiency, this value |
| 1354 | 1354 | @ should be larger rather than smaller. |
| 1355 | 1355 | @ (Property: "chat-poll-timeout")</p> |
| 1356 | 1356 | @ <hr /> |
| 1357 | 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> | |
| 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> | |
| 1364 | 1363 | @ <hr /> |
| 1365 | 1364 | |
| 1366 | 1365 | multiple_choice_attribute("Alert sound", |
| 1367 | 1366 | "chat-alert-sound", "snd", azAlerts[0], |
| 1368 | 1367 | count(azAlerts)/2, azAlerts); |
| 1369 | 1368 |
| --- 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 |