Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fix several merge conflict issues from the previous check-in. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | th1Hooks |
| Files: | files | file ages | folders |
| SHA1: |
1f915a6859ac25beab43e7c0945543a8 |
| User & Date: | mistachkin 2014-06-08 00:16:20.390 |
Context
|
2014-06-08
| ||
| 00:38 | Make the 'tcl-setup', 'th1-setup', and 'th1-uri-regexp' settings versionable. ... (check-in: 9952893360 user: mistachkin tags: th1Hooks) | |
| 00:16 | Fix several merge conflict issues from the previous check-in. ... (check-in: 1f915a6859 user: mistachkin tags: th1Hooks) | |
| 00:03 | Merge updates from trunk. ... (check-in: f91d313169 user: mistachkin tags: th1Hooks) | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
798 799 800 801 802 803 804 |
** operations which hold an exclusive transaction. In a few cases, though,
** it is convenient for the ~/.fossil to be attached to the main database
** connection so that we can join between the various databases. In that
** case, invoke this routine with useAttach as 1.
*/
void db_open_config(int useAttach){
char *zDbName;
| | | | 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 |
** operations which hold an exclusive transaction. In a few cases, though,
** it is convenient for the ~/.fossil to be attached to the main database
** connection so that we can join between the various databases. In that
** case, invoke this routine with useAttach as 1.
*/
void db_open_config(int useAttach){
char *zDbName;
char *zHome;
if( g.zConfigDbName ){
if( useAttach==g.useAttach ) return;
if( g.useAttach ){
db_detach("configdb");
g.useAttach = 0;
}else if( g.dbConfig ){
sqlite3_close(g.dbConfig);
g.dbConfig = 0;
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
620 621 622 623 624 625 626 |
g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
g.fSshClient = 0;
g.zSshCmd = 0;
if( g.fSqlTrace ) g.fSqlStats = 1;
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
g.fNoThHook = find_option("no-th-hook", 0, 0)!=0;
| < | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 |
g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
g.fSshClient = 0;
g.zSshCmd = 0;
if( g.fSqlTrace ) g.fSqlStats = 1;
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
g.fNoThHook = find_option("no-th-hook", 0, 0)!=0;
g.zHttpAuth = 0;
g.zLogin = find_option("user", "U", 1);
g.zSSLIdentity = find_option("ssl-identity", 0, 1);
g.zErrlog = find_option("errorlog", 0, 1);
if( find_option("utc",0,0) ) g.fTimeFormat = 1;
if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
if( zChdir && file_chdir(zChdir, 0) ){
|
| ︙ | ︙ |
Changes to src/th_main.c.
| ︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | */ #define TH_INIT_NONE ((u32)0x00000000) /* No flags. */ #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */ #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */ #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH commands re-added? */ #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */ #define TH_INIT_DEFAULT (TH_INIT_NONE) /* Default flags. */ #endif /* ** These are the "well-known" TH1 error messages that occur when no hook is ** registered to be called prior to executing a command or processing a web ** page, respectively. If one of these errors is seen, it will not be sent ** or displayed to the remote user or local interactive user, respectively. | > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | */ #define TH_INIT_NONE ((u32)0x00000000) /* No flags. */ #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */ #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */ #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH commands re-added? */ #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */ #define TH_INIT_DEFAULT (TH_INIT_NONE) /* Default flags. */ #define TH_INIT_HOOK (TH_INIT_NEED_CONFIG|TH_INIT_FORCE_SETUP) #endif /* ** These are the "well-known" TH1 error messages that occur when no hook is ** registered to be called prior to executing a command or processing a web ** page, respectively. If one of these errors is seen, it will not be sent ** or displayed to the remote user or local interactive user, respectively. |
| ︙ | ︙ | |||
1199 1200 1201 1202 1203 1204 1205 |
** cause the actual command execution to be skipped.
*/
int Th_CommandHook(
const char *zName,
char cmdFlags
){
int rc = TH_OK;
| | | 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 |
** cause the actual command execution to be skipped.
*/
int Th_CommandHook(
const char *zName,
char cmdFlags
){
int rc = TH_OK;
Th_FossilInit(TH_INIT_HOOK);
Th_Store("cmd_name", zName);
Th_StoreInt("cmd_flags", cmdFlags);
rc = Th_Eval(g.interp, 0, "command_hook", -1);
if( rc==TH_ERROR ){
int nResult = 0;
char *zResult = (char*)Th_GetResult(g.interp, &nResult);
/*
|
| ︙ | ︙ | |||
1223 1224 1225 1226 1227 1228 1229 |
** not exist because commands are not being hooked), return TH_OK because we
** do not want to skip executing essential commands unless the called command
** (i.e. "command_hook") explicitly forbids this by successfully returning
** TH_BREAK or TH_CONTINUE.
*/
if( g.thTrace ){
Th_Trace("[command_hook {%h}] => %h<br />\n", zName,
| | | | | | 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 |
** not exist because commands are not being hooked), return TH_OK because we
** do not want to skip executing essential commands unless the called command
** (i.e. "command_hook") explicitly forbids this by successfully returning
** TH_BREAK or TH_CONTINUE.
*/
if( g.thTrace ){
Th_Trace("[command_hook {%h}] => %h<br />\n", zName,
Th_ReturnCodeName(rc, 0));
}
return (rc != TH_ERROR) ? rc : TH_OK;
}
/*
** This function is called by Fossil just after dispatching a command.
** Returning a value other than TH_OK from this function (i.e. via an
** evaluated script raising an error or calling [break]/[continue]) may
** cause an error message to be displayed to the local interactive user.
** Currently, TH1 error messages generated by this function are ignored.
*/
int Th_CommandNotify(
const char *zName,
char cmdFlags
){
int rc;
Th_FossilInit(TH_INIT_HOOK);
Th_Store("cmd_name", zName);
Th_StoreInt("cmd_flags", cmdFlags);
rc = Th_Eval(g.interp, 0, "command_notify", -1);
if( g.thTrace ){
Th_Trace("[command_notify {%h}] => %h<br />\n", zName,
Th_ReturnCodeName(rc, 0));
}
return rc;
}
/*
** This function is called by Fossil just prior to processing a web page.
** Returning a value other than TH_OK from this function (i.e. via an
** evaluated script raising an error or calling [break]/[continue]) will
** cause the actual web page processing to be skipped.
*/
int Th_WebpageHook(
const char *zName,
char cmdFlags
){
int rc = TH_OK;
Th_FossilInit(TH_INIT_HOOK);
Th_Store("web_name", zName);
Th_StoreInt("web_flags", cmdFlags);
rc = Th_Eval(g.interp, 0, "webpage_hook", -1);
if( rc==TH_ERROR ){
int nResult = 0;
char *zResult = (char*)Th_GetResult(g.interp, &nResult);
/*
|
| ︙ | ︙ | |||
1286 1287 1288 1289 1290 1291 1292 |
** not exist because commands are not being hooked), return TH_OK because we
** do not want to skip processing essential web pages unless the called
** command (i.e. "webpage_hook") explicitly forbids this by successfully
** returning TH_BREAK or TH_CONTINUE.
*/
if( g.thTrace ){
Th_Trace("[webpage_hook {%h}] => %h<br />\n", zName,
| | | | | 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 |
** not exist because commands are not being hooked), return TH_OK because we
** do not want to skip processing essential web pages unless the called
** command (i.e. "webpage_hook") explicitly forbids this by successfully
** returning TH_BREAK or TH_CONTINUE.
*/
if( g.thTrace ){
Th_Trace("[webpage_hook {%h}] => %h<br />\n", zName,
Th_ReturnCodeName(rc, 0));
}
return (rc != TH_ERROR) ? rc : TH_OK;
}
/*
** This function is called by Fossil just after processing a web page.
** Returning a value other than TH_OK from this function (i.e. via an
** evaluated script raising an error or calling [break]/[continue]) may
** cause an error message to be displayed to the remote user.
** Currently, TH1 error messages generated by this function are ignored.
*/
int Th_WebpageNotify(
const char *zName,
char cmdFlags
){
int rc;
Th_FossilInit(TH_INIT_HOOK);
Th_Store("web_name", zName);
Th_StoreInt("web_flags", cmdFlags);
rc = Th_Eval(g.interp, 0, "webpage_notify", -1);
if( g.thTrace ){
Th_Trace("[webpage_notify {%h}] => %h<br />\n", zName,
Th_ReturnCodeName(rc, 0));
}
return rc;
}
/*
** The z[] input contains text mixed with TH1 scripts.
** The TH1 scripts are contained within <th1>...</th1>.
|
| ︙ | ︙ | |||
1439 1440 1441 1442 1443 1444 1445 |
}else if( fossil_stricmp(g.argv[2], "webnotify")==0 ){
rc = Th_WebpageNotify(g.argv[3], (char)atoi(g.argv[4]));
}else{
fossil_fatal("Unknown TH1 hook %s\n", g.argv[2]);
}
zResult = (char*)Th_GetResult(g.interp, &nResult);
sendText("RESULT (", -1, 0);
| | | 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 |
}else if( fossil_stricmp(g.argv[2], "webnotify")==0 ){
rc = Th_WebpageNotify(g.argv[3], (char)atoi(g.argv[4]));
}else{
fossil_fatal("Unknown TH1 hook %s\n", g.argv[2]);
}
zResult = (char*)Th_GetResult(g.interp, &nResult);
sendText("RESULT (", -1, 0);
sendText(Th_ReturnCodeName(rc, 0), -1, 0);
sendText("): ", -1, 0);
sendText(zResult, nResult, 0);
sendText("\n", -1, 0);
}
|