Changeset 3168
Merge 3167 from trunk (Fix GotoIfTime/ExecIfTime)
Committed by:
mjagdis
Date:
Jun 27 2007 * 00:24 (about 1 year ago)
Affected files:
callweaver/branches/rel/1.2/corelib/pbx.c (unified diff)
| r3078 | r3168 | |
|---|---|---|
| 6458 | 6458 | static int pbx_builtin_gotoiftime(struct opbx_channel *chan, int argc, char **argv) |
| 6459 | 6459 | { |
| 6460 | 6460 | struct opbx_timing timing; |
| 6461 | char *s; | |
| 6461 | char *s, *q; | |
| 6462 | 6462 | |
| 6463 | s = NULL; | |
| 6464 | if (argc > 3) { | |
| 6465 | s = strchr(argv[3], '?'); | |
| 6466 | if (s) while (isspace(*(++s))); | |
| 6467 | } | |
| 6468 | ||
| 6469 | if (!s || !*s || argc > 6) { | |
| 6463 | if (argc < 4 || argc > 6 || !(s = strchr(argv[3], '?'))) { | |
| 6470 | 6464 | opbx_log(LOG_WARNING, "GotoIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>?[[context,]extension,]priority\n"); |
| 6471 | 6465 | return -1; |
| 6472 | 6466 | } |
| 6473 | 6467 | |
| 6468 | /* Trim trailing space from the timespec */ | |
| 6469 | q = s; | |
| 6470 | do { *(q--) = '\0'; } while (q >= argv[3] && isspace(*q)); | |
| 6471 | ||
| 6474 | 6472 | get_timerange(&timing, argv[0]); |
| 6475 | 6473 | timing.dowmask = get_dow(argv[1]); |
| 6476 | 6474 | timing.daymask = get_day(argv[2]); |
| 6477 | 6475 | timing.monthmask = get_month(argv[3]); |
| 6478 | 6476 | |
| 6479 | 6477 | if (opbx_check_timing(&timing)) { |
| 6478 | do { *(s++) = '\0'; } while (isspace(*s)); | |
| 6480 | 6479 | argv[3] = s; |
| 6481 | 6480 | argv += 3; |
| 6482 | 6481 | argc -= 3; |
| --- | --- | |
| 6489 | 6488 | static int pbx_builtin_execiftime(struct opbx_channel *chan, int argc, char **argv) |
| 6490 | 6489 | { |
| 6491 | 6490 | struct opbx_timing timing; |
| 6492 | char *s; | |
| 6491 | char *s, *q; | |
| 6493 | 6492 | |
| 6494 | s = NULL; | |
| 6495 | if (argc > 3) { | |
| 6496 | s = strchr(argv[3], '?'); | |
| 6497 | if (s) while (isspace(*(++s))); | |
| 6498 | } | |
| 6499 | ||
| 6500 | if (!s || !*s) { | |
| 6493 | if (argc < 4 || !(s = strchr(argv[3], '?'))) { | |
| 6501 | 6494 | opbx_log(LOG_WARNING, "ExecIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>?<appname>[(<args>)]\n"); |
| 6502 | 6495 | return -1; |
| 6503 | 6496 | } |
| 6504 | 6497 | |
| 6498 | /* Trim trailing space from the timespec */ | |
| 6499 | q = s; | |
| 6500 | do { *(q--) = '\0'; } while (q >= argv[3] && isspace(*q)); | |
| 6501 | ||
| 6505 | 6502 | get_timerange(&timing, argv[0]); |
| 6506 | 6503 | timing.dowmask = get_dow(argv[1]); |
| 6507 | 6504 | timing.daymask = get_day(argv[2]); |
| 6508 | 6505 | timing.monthmask = get_month(argv[3]); |
| 6509 | 6506 | |
| 6510 | 6507 | if (opbx_check_timing(&timing)) { |
| 6511 | struct opbx_app *app = pbx_findapp(s); | |
| 6508 | struct opbx_app *app; | |
| 6509 | do { *(s++) = '\0'; } while (isspace(*s)); | |
| 6510 | app = pbx_findapp(s); | |
| 6512 | 6511 | if (app) { |
| 6513 | 6512 | if ((s = strchr(s, '('))) { |
| 6514 | 6513 | argv[0] = s + 1; |
| --- | --- | |
| 6516 | 6515 | *s = '\0'; |
| 6517 | 6516 | return pbx_exec(chan, app, argv[0]); |
| 6518 | 6517 | } else { |
| 6519 | return pbx_exec_argv(chan, app, argc - 4, argv + 5); | |
| 6518 | return pbx_exec_argv(chan, app, argc - 4, argv + 4); | |
| 6520 | 6519 | } |
| 6521 | 6520 | } else { |
| 6522 | 6521 | opbx_log(LOG_WARNING, "Cannot locate application %s\n", s); |
![Home changeset 3168 [home]](/images/logo.png?1180520111)
RSS Feeds