| 4214 | static struct delayed_event *delayed_events; |
| 4215 | |
| 4216 | int handle_custom_event (const TCHAR *custom, int append) |
| 4217 | { |
| 4218 | TCHAR *p, *buf, *nextp; |
| 4219 | bool noquot = false; |
| 4220 | bool first = true; |
| 4221 | int adddelay = 0; |
| 4222 | bool maybe_config_changed = false; |
| 4223 | |
| 4224 | if (custom == NULL) { |
| 4225 | return 0; |
| 4226 | } |
| 4227 | //write_log (_T("%s\n"), custom); |
| 4228 | |
| 4229 | if (append) { |
| 4230 | struct delayed_event *dee = delayed_events, *prev = NULL; |
| 4231 | while (dee) { |
| 4232 | if (dee->delay > 0 && dee->delay > adddelay && dee->append) { |
| 4233 | adddelay = dee->delay; |
| 4234 | } |
| 4235 | prev = dee; |
| 4236 | dee = dee->next; |
| 4237 | } |
| 4238 | } |
| 4239 | |
| 4240 | p = buf = my_strdup_trim (custom); |
| 4241 | if (p[0] != '\"') |
| 4242 | noquot = true; |
| 4243 | while (p && *p) { |
| 4244 | TCHAR *p2 = NULL; |
| 4245 | if (!noquot) { |
| 4246 | if (*p != '\"') |
| 4247 | break; |
| 4248 | p++; |
| 4249 | p2 = p; |
| 4250 | while (*p2 != '\"' && *p2 != 0) |
| 4251 | p2++; |
| 4252 | if (*p2 == '\"') { |
| 4253 | *p2++ = 0; |
| 4254 | nextp = p2 + 1; |
| 4255 | while (*nextp == ' ') |
| 4256 | nextp++; |
| 4257 | } |
| 4258 | } |
| 4259 | //write_log (L"-> '%s'\n", p); |
| 4260 | if (!_tcsnicmp (p, _T("delay "), 6) || !_tcsnicmp (p, _T("vdelay "), 7) || !_tcsnicmp (p, _T("hdelay "), 7) || adddelay) { |
| 4261 | TCHAR *next = NULL; |
| 4262 | int delay = -1; |
| 4263 | if (!_tcsnicmp (p, _T("delay "), 6)) { |
| 4264 | next = p + 7; |
| 4265 | delay = _tstol(p + 6) * maxvpos_nom; |
| 4266 | if (!delay) |
| 4267 | delay = maxvpos_nom; |
| 4268 | } else if (!_tcsnicmp (p, _T("vdelay "), 7)) { |
| 4269 | next = p + 8; |
| 4270 | delay = _tstol(p + 7) * maxvpos_nom; |
| 4271 | if (!delay) |
| 4272 | delay = maxvpos_nom; |
| 4273 | } else if (!_tcsnicmp (p, _T("hdelay "), 7)) { |
no test coverage detected