]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/command/generic.qc
04fbc445da76a203231e3fee139bc6ec01675aaa
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / command / generic.qc
1 #include "all.qh"
2
3 #include "markup.qh"
4 #include "rpn.qh"
5
6 #include "../mapinfo.qh"
7
8 #ifndef MENUQC
9         #include "../notifications.qh"
10 #endif
11
12 #ifdef CSQC
13         #include <client/commands/cl_cmd.qh>
14 #endif
15
16 #ifdef SVQC
17         #include <server/command/banning.qh>
18         #include <server/command/cmd.qh>
19         #include <server/command/common.qh>
20         #include <server/command/sv_cmd.qh>
21         #include <common/turrets/config.qh>
22         #include <common/weapons/config.qh>
23 #endif
24
25 // =========================================================
26 //  Generic program common command code, written by Samual
27 //  Last updated: February 19th, 2012
28 // =========================================================
29
30 // used by generic commands for better help/usage information
31 string GetProgramCommandPrefix()
32 {
33         #ifdef SVQC
34         return "sv_cmd";
35         #endif
36         #ifdef CSQC
37         return "cl_cmd";
38         #endif
39         #ifdef MENUQC
40         return "menu_cmd";
41         #endif
42 }
43
44 // used by curl command
45 void Curl_URI_Get_Callback(int id, float status, string data)
46 {
47         int i = id - URI_GET_CURL;
48         float do_exec = curl_uri_get_exec[i];
49         string do_cvar = curl_uri_get_cvar[i];
50         if(status != 0)
51         {
52                 LOG_TRACEF("error: status is %d\n", status);
53                 if(do_cvar)
54                         strunzone(do_cvar);
55                 return;
56         }
57         if(do_exec)
58                 localcmd(data);
59         if(do_cvar)
60         {
61                 cvar_set(do_cvar, data);
62                 strunzone(do_cvar);
63         }
64         if(!do_exec)
65                 if (!do_cvar)
66                         LOG_INFO(data);
67 }
68
69
70 // =======================
71 //  Command Sub-Functions
72 // =======================
73
74 void GenericCommand_addtolist(float request, float argc)
75 {
76         switch(request)
77         {
78                 case CMD_REQUEST_COMMAND:
79                 {
80                         if(argc >= 2)
81                         {
82                                 string original_cvar = argv(1);
83                                 string tmp_string = argv(2);
84
85                                 if(cvar_string(original_cvar) == "") // cvar was empty
86                                 {
87                                         cvar_set(original_cvar, tmp_string);
88                                 }
89                                 else // add it to the end of the list if the list doesn't already have it
90                                 {
91                                         argc = tokenizebyseparator(cvar_string(original_cvar), " ");
92                                         int i;
93                                         for(i = 0; i < argc; ++i)
94                                                 if(argv(i) == tmp_string)
95                                                         return; // already in list
96
97                                         cvar_set(original_cvar, strcat(tmp_string, " ", cvar_string(original_cvar)));
98                                 }
99                                 return;
100                         }
101                 }
102
103                 default:
104                         LOG_INFO("Incorrect parameters for ^2addtolist^7\n");
105                 case CMD_REQUEST_USAGE:
106                 {
107                         LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " addtolist variable value\n"));
108                         LOG_INFO("  Where 'variable' is what to add 'value' to.\n");
109                         LOG_INFO("See also: ^2removefromlist^7\n");
110                         return;
111                 }
112         }
113 }
114
115 void GenericCommand_qc_curl(float request, float argc)
116 {
117         switch(request)
118         {
119                 case CMD_REQUEST_COMMAND:
120                 {
121                         bool do_exec = false;
122                         string do_cvar = string_null;
123                         float key = -1;
124                         int i;
125                         for(i = 1; i+1 < argc; ++i)
126                         {
127                                 if(argv(i) == "--cvar" && i+2 < argc)
128                                 {
129                                         ++i;
130                                         do_cvar = strzone(argv(i));
131                                         continue;
132                                 }
133                                 if(argv(i) == "--exec")
134                                 {
135                                         do_exec = true;
136                                         continue;
137                                 }
138                                 if(argv(i) == "--key" && i+2 < argc)
139                                 {
140                                         ++i;
141                                         key = stof(argv(i));
142                                         continue;
143                                 }
144                                 break;
145                         }
146
147                         // now, argv(i) is the URL
148                         // following args may be POST parameters
149                         string url = argv(i);
150                         ++i;
151                         float buf = buf_create();
152                         int j;
153                         for(j = 0; i+1 < argc; i += 2)
154                                 bufstr_set(buf, ++j, sprintf("%s=%s", uri_escape(argv(i)), uri_escape(argv(i+1))));
155                         if(i < argc)
156                                 bufstr_set(buf, ++j, sprintf("submit=%s", uri_escape(argv(i))));
157
158                         float r;
159                         if(j == 0) // no args: GET
160                                 r = crypto_uri_postbuf(url, URI_GET_CURL + curl_uri_get_pos, string_null, string_null, -1, key);
161                         else // with args: POST
162                                 r = crypto_uri_postbuf(url, URI_GET_CURL + curl_uri_get_pos, "application/x-www-form-urlencoded", "&", buf, key);
163
164                         if(r)
165                         {
166                                 curl_uri_get_exec[curl_uri_get_pos] = do_exec;
167                                 curl_uri_get_cvar[curl_uri_get_pos] = do_cvar;
168                                 curl_uri_get_pos = (curl_uri_get_pos + 1) % (URI_GET_CURL_END - URI_GET_CURL + 1);
169                         }
170                         else
171                                 LOG_INFO(_("error creating curl handle\n"));
172
173                         buf_del(buf);
174
175                         return;
176                 }
177
178                 default:
179                 case CMD_REQUEST_USAGE:
180                 {
181                         LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " qc_curl [--key N] [--cvar] [--exec] URL [postargs...]"));
182                         return;
183                 }
184         }
185 }
186
187 GENERIC_COMMAND(dumpcommands, "Dump all commands on the program to *_cmd_dump.txt")
188 {
189         switch(request)
190         {
191                 case CMD_REQUEST_COMMAND:
192                 {
193                         float fh;
194                         string filename = strcat(GetProgramCommandPrefix(), "_dump.txt");
195                         fh = fopen(filename, FILE_WRITE);
196
197                         if(fh >= 0)
198                         {
199                                 #ifdef SVQC
200                                         CMD_Write("dump of server console commands:\n");
201                                         GameCommand_macro_write_aliases(fh);
202
203                                         CMD_Write("\ndump of networked client only commands:\n");
204                                         ClientCommand_macro_write_aliases(fh);
205
206                                         CMD_Write("\ndump of common commands:\n");
207                                         CommonCommand_macro_write_aliases(fh);
208
209                                         CMD_Write("\ndump of ban commands:\n");
210                                         BanCommand_macro_write_aliases(fh);
211                                 #endif
212
213                                 #ifdef CSQC
214                                         CMD_Write("dump of client commands:\n");
215                                         LocalCommand_macro_write_aliases(fh);
216                                 #endif
217
218                                 CMD_Write("\ndump of generic commands:\n");
219                                 GenericCommand_macro_write_aliases(fh);
220
221                                 LOG_INFO("Completed dump of aliases in ^2data/data/", GetProgramCommandPrefix(), "_dump.txt^7.\n");
222
223                                 fclose(fh);
224                         }
225                         else
226                         {
227                                 LOG_INFO("^1Error: ^7Could not dump to file!\n");
228                         }
229                         return;
230                 }
231
232                 default:
233                 case CMD_REQUEST_USAGE:
234                 {
235                         LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpcommands"));
236                         LOG_INFO("  No arguments required.\n");
237                         return;
238                 }
239         }
240 }
241
242 void GenericCommand_maplist(float request, float argc)
243 {
244         switch(request)
245         {
246                 case CMD_REQUEST_COMMAND:
247                 {
248                         string tmp_string;
249                         float i;
250
251                         switch(argv(1))
252                         {
253                                 case "add": // appends new maps to the maplist
254                                 {
255                                         if(argc == 3)
256                                         {
257                                                 if (!fexists(strcat("maps/", argv(2), ".bsp")))
258                                                 {
259                                                         LOG_INFO("maplist: ERROR: ", argv(2), " does not exist!\n");
260                                                         break;
261                                                 }
262
263                                                 if(cvar_string("g_maplist") == "")
264                                                         cvar_set("g_maplist", argv(2));
265                                                 else
266                                                         cvar_set("g_maplist", strcat(argv(2), " ", cvar_string("g_maplist")));
267
268                                                 return;
269                                         }
270                                         break; // go to usage
271                                 }
272
273                                 case "cleanup": // scans maplist and only adds back the ones which are really usable
274                                 {
275                                         MapInfo_Enumerate();
276                                         MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
277                                         string filtered = "";
278                                         FOREACH_WORD(cvar_string("g_maplist"), MapInfo_CheckMap(it), filtered = cons(filtered, it));
279                                         cvar_set("g_maplist", filtered);
280                                         return;
281                                 }
282
283                                 case "remove": // scans maplist and only adds back whatever maps were not provided in argv(2)
284                                 {
285                                         if(argc == 3)
286                                         {
287                                                 argc = tokenizebyseparator(cvar_string("g_maplist"), " ");
288
289                                                 tmp_string = "";
290                                                 for(i = 0; i < argc; ++i)
291                                                         if(argv(i) != argv(2))
292                                                                 tmp_string = strcat(tmp_string, " ", argv(i));
293
294                                                 tmp_string = substring(tmp_string, 1, strlen(tmp_string) - 1);
295                                                 cvar_set("g_maplist", tmp_string);
296
297                                                 return;
298                                         }
299                                         break; // go to usage
300                                 }
301
302                                 case "shuffle": // randomly shuffle the maplist
303                                 {
304                                         cvar_set("g_maplist", shufflewords(cvar_string("g_maplist")));
305                                         return;
306                                 }
307
308                                 default: break;
309                         }
310                 }
311
312                 default:
313                         LOG_INFO("Incorrect parameters for ^2maplist^7\n");
314                 case CMD_REQUEST_USAGE:
315                 {
316                         LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " maplist action [map]\n"));
317                         LOG_INFO("  Where 'action' is the command to complete,\n");
318                         LOG_INFO("  and 'map' is what it acts upon (if required).\n");
319                         LOG_INFO("  Full list of commands here: \"add, cleanup, remove, shuffle.\"\n");
320                         return;
321                 }
322         }
323 }
324
325 void GenericCommand_nextframe(float request, float arguments, string command)
326 {
327         switch(request)
328         {
329                 case CMD_REQUEST_COMMAND:
330                 {
331                         queue_to_execute_next_frame(substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
332                         return;
333                 }
334
335                 default:
336                 case CMD_REQUEST_USAGE:
337                 {
338                         LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " nextframe command...\n"));
339                         LOG_INFO("  Where command will be executed next frame of this VM\n");
340                         return;
341                 }
342         }
343 }
344
345 void GenericCommand_removefromlist(float request, float argc)
346 {
347         switch(request)
348         {
349                 case CMD_REQUEST_COMMAND:
350                 {
351                         if(argc == 3)
352                         {
353                                 float i;
354                                 string original_cvar = argv(1);
355                                 string removal = argv(2);
356                                 string tmp_string;
357
358                                 argc = tokenizebyseparator(cvar_string(original_cvar), " ");
359
360                                 tmp_string = "";
361                                 for(i = 0; i < argc; ++i)
362                                         if(argv(i) != removal)
363                                                 tmp_string = strcat(tmp_string, " ", argv(i));
364
365                                 tmp_string = substring(tmp_string, 1, strlen(tmp_string) - 1);
366                                 cvar_set(original_cvar, tmp_string);
367
368                                 return;
369                         }
370                 }
371
372                 default:
373                         LOG_INFO("Incorrect parameters for ^2removefromlist^7\n");
374                 case CMD_REQUEST_USAGE:
375                 {
376                         LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " removefromlist variable value\n"));
377                         LOG_INFO("  Where 'variable' is what cvar to remove 'value' from.\n");
378                         LOG_INFO("See also: ^2addtolist^7\n");
379                         return;
380                 }
381         }
382 }
383
384 void GenericCommand_restartnotifs(float request)
385 {
386         switch(request)
387         {
388                 case CMD_REQUEST_COMMAND:
389                 {
390                         #ifndef MENUQC
391                         int NOTIF_ANNCE_COUNT   = 0; FOREACH(Notifications, it.nent_type == MSG_ANNCE,   { ++NOTIF_ANNCE_COUNT;  });
392                         int NOTIF_INFO_COUNT    = 0; FOREACH(Notifications, it.nent_type == MSG_INFO,    { ++NOTIF_INFO_COUNT;   });
393                         int NOTIF_CENTER_COUNT  = 0; FOREACH(Notifications, it.nent_type == MSG_CENTER,  { ++NOTIF_CENTER_COUNT; });
394                         int NOTIF_MULTI_COUNT   = 0; FOREACH(Notifications, it.nent_type == MSG_MULTI,   { ++NOTIF_MULTI_COUNT;  });
395                         int NOTIF_CHOICE_COUNT  = 0; FOREACH(Notifications, it.nent_type == MSG_CHOICE,  { ++NOTIF_CHOICE_COUNT; });
396                         LOG_INFOF(
397                                 strcat(
398                                         "Restart_Notifications(): Restarting %d notifications... ",
399                                         "Counts: MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d\n"
400                                 ),
401                                 (
402                                         NOTIF_ANNCE_COUNT +
403                                         NOTIF_INFO_COUNT +
404                                         NOTIF_CENTER_COUNT +
405                                         NOTIF_MULTI_COUNT +
406                                         NOTIF_CHOICE_COUNT
407                                 ),
408                                 NOTIF_ANNCE_COUNT,
409                                 NOTIF_INFO_COUNT,
410                                 NOTIF_CENTER_COUNT,
411                                 NOTIF_MULTI_COUNT,
412                                 NOTIF_CHOICE_COUNT
413                         );
414                         Destroy_All_Notifications();
415                         CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
416                         #else
417                         LOG_INFO(_("Notification restart command only works with cl_cmd and sv_cmd.\n"));
418                         #endif
419                         return;
420                 }
421
422                 default:
423                 case CMD_REQUEST_USAGE:
424                 {
425                         LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " restartnotifs"));
426                         LOG_INFO("  No arguments required.\n");
427                         return;
428                 }
429         }
430 }
431
432 void GenericCommand_settemp(float request, float argc)
433 {
434         switch(request)
435         {
436                 case CMD_REQUEST_COMMAND:
437                 {
438                         if(argc >= 3)
439                         {
440                                 float f = cvar_settemp(argv(1), argv(2));
441                                 if(f == 1)
442                                         LOG_TRACE("Creating new settemp tracker for ", argv(1), " and setting it to \"", argv(2), "\" temporarily.\n");
443                                 else if(f == -1)
444                                         LOG_TRACE("Already had a tracker for ", argv(1), ", updating it to \"", argv(2), "\".\n");
445                                 // else cvar_settemp itself errors out
446
447                                 return;
448                         }
449                 }
450
451                 default:
452                         LOG_INFO("Incorrect parameters for ^2settemp^7\n");
453                 case CMD_REQUEST_USAGE:
454                 {
455                         LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " settemp \"cvar\" \"arguments\"\n"));
456                         LOG_INFO("  Where 'cvar' is the cvar you want to temporarily set with 'arguments'.\n");
457                         LOG_INFO("See also: ^2settemp_restore^7\n");
458                         return;
459                 }
460         }
461 }
462
463 void GenericCommand_settemp_restore(float request, float argc)
464 {
465         switch(request)
466         {
467                 case CMD_REQUEST_COMMAND:
468                 {
469                         float i = cvar_settemp_restore();
470
471                         if(i)
472                                 LOG_TRACE("Restored ", ftos(i), " temporary cvar settings to their original values.\n");
473                         else
474                                 LOG_TRACE("Nothing to restore.\n");
475
476                         return;
477                 }
478
479                 default:
480                 case CMD_REQUEST_USAGE:
481                 {
482                         LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " settemp_restore\n"));
483                         LOG_INFO("  No arguments required.\n");
484                         LOG_INFO("See also: ^2settemp^7\n");
485                         return;
486                 }
487         }
488 }
489
490 void GenericCommand_runtest(float request, float argc)
491 {
492         switch(request)
493         {
494                 case CMD_REQUEST_COMMAND:
495                 {
496                         if(argc > 1)
497                         {
498                                 float i;
499                                 for(i = 1; i < argc; ++i)
500                                         TEST_Run(argv(i));
501                         }
502                         else
503                                 RUN_ALL_TESTS();
504                         return;
505                 }
506
507                 default:
508                 case CMD_REQUEST_USAGE:
509                 {
510                         LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " [function to run]"));
511                         return;
512                 }
513         }
514 }
515
516 /* use this when creating a new command, making sure to place it in alphabetical order... also,
517 ** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION!
518 void GenericCommand_(float request)
519 {
520         switch(request)
521         {
522                 case CMD_REQUEST_COMMAND:
523                 {
524
525                         return;
526                 }
527
528                 default:
529                 case CMD_REQUEST_USAGE:
530                 {
531                         print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " "));
532                         print("  No arguments required.\n");
533                         return;
534                 }
535         }
536 }
537 */
538
539 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
540 GENERIC_COMMAND(addtolist, "Add a string to a cvar") { GenericCommand_addtolist(request, arguments); }
541 GENERIC_COMMAND(maplist, "Automatic control of maplist") { GenericCommand_maplist(request, arguments); }
542 GENERIC_COMMAND(nextframe, "Execute the given command next frame of this VM") { GenericCommand_nextframe(request, arguments, command); }
543 GENERIC_COMMAND(qc_curl, "Queries a URL") { GenericCommand_qc_curl(request, arguments); }
544 GENERIC_COMMAND(removefromlist, "Remove a string from a cvar") { GenericCommand_removefromlist(request, arguments); }
545 GENERIC_COMMAND(restartnotifs, "Re-initialize all notifications") { GenericCommand_restartnotifs(request); }
546 GENERIC_COMMAND(rpn, "RPN calculator") { GenericCommand_rpn(request, arguments, command); }
547 GENERIC_COMMAND(settemp, "Temporarily set a value to a cvar which is restored later") { GenericCommand_settemp(request, arguments); }
548 GENERIC_COMMAND(settemp_restore, "Restore all cvars set by settemp command") { GenericCommand_settemp_restore(request, arguments); }
549 GENERIC_COMMAND(runtest, "Run unit tests") { GenericCommand_runtest(request, arguments); }
550
551 void GenericCommand_macro_help()
552 {
553         FOREACH(GENERIC_COMMANDS, true, LAMBDA(LOG_INFOF("  ^2%s^7: %s\n", it.m_name, it.m_description)));
554 }
555
556 float GenericCommand_macro_command(float argc, string command)
557 {
558         string c = strtolower(argv(0));
559         FOREACH(GENERIC_COMMANDS, it.m_name == c, LAMBDA(
560                 it.m_invokecmd(CMD_REQUEST_COMMAND, NULL, argc, command);
561                 return true;
562         ));
563         return false;
564 }
565
566 float GenericCommand_macro_usage(float argc)
567 {
568         string c = strtolower(argv(1));
569         FOREACH(GENERIC_COMMANDS, it.m_name == c, LAMBDA(
570                 it.m_invokecmd(CMD_REQUEST_USAGE, NULL, argc, "");
571                 return true;
572         ));
573         return false;
574 }
575
576 void GenericCommand_macro_write_aliases(float fh)
577 {
578         FOREACH(GENERIC_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_svmenu", it.m_name, it.m_description)));
579 }
580
581
582 // ===========================================
583 //  Main Common Function For Generic Commands
584 // ===========================================
585 // Commands spread out among all programs (menu, client, and server)
586
587 float GenericCommand(string command)
588 {
589         float argc = tokenize_console(command);
590         float n, j, f, i;
591         string s, s2, c;
592         vector rgb;
593
594         // Guide for working with argc arguments by example:
595         // argc:   1    - 2      - 3     - 4
596         // argv:   0    - 1      - 2     - 3
597         // cmd     vote - master - login - password
598
599         if(GenericCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
600         {
601                 return true; // handled by one of the above GenericCommand_* functions
602         }
603         else if(argc >= 3 && argv(0) == "red")
604         {
605                 s = substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2));
606                 localcmd(strcat(argv(1), " ", GenericCommand_markup(s)));
607                 return true;
608         }
609         else if(argc >= 3 && crc16(0, argv(0)) == 38566 && crc16(0, strcat(argv(0), argv(0), argv(0))) == 59830)
610         {
611                 // other test case
612                 s = strconv(2, 0, 0, substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
613
614                 n = floor(random() * 6 + 2);
615
616                 s2 = "";
617                 for(i = 0; i < n; ++i)
618                 {
619                         s2 = strcat(s2, "AH");
620                 }
621
622                 if(random() < 0.1)
623                         s2 = strcat(substring(s2, 1, strlen(s2) - 1), "A");
624
625                 if(s == "")
626                         s = s2;
627                 else
628                         if(random() < 0.8)
629                                 s = strcat(s, " ", s2);
630                         else
631                                 s = strcat(s2, " ", s);
632
633                 s2 = substring(s, strlen(s) - 2, 2);
634                 if(s2 == "AH" || s2 == "AY")
635                         s = strcat(s, "))");
636                 else
637                         s = strcat(s, " ))");
638
639                 if(random() < 0.1)
640                         s = substring(s, 0, strlen(s) - 1);
641
642                 if(random() < 0.1)
643                         s = strconv(1, 0, 0, s);
644
645                 localcmd(strcat(argv(1), " ", s));
646
647                 return true;
648         }
649         else if(argc >= 3 && crc16(0, argv(0)) == 3826 && crc16(0, strcat(argv(0), argv(0), argv(0))) == 55790)
650         {
651                 // test case for terencehill's color codes
652                 s = strdecolorize(substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
653                 s2 = "";
654
655                 n = strlen(s);
656                 j = ((6 * max(1, floor(strlen(s)/32 + random() * 2 - 1))) / n) * (1 - 2 * (random() > 0.5));
657                 f = random() * 6;
658
659                 for(i = 0; i < n; ++i)
660                 {
661                         c = substring(s, i, 1);
662
663                         if(c == ";")
664                                 c = ":";
665                         else if(c == "^")
666                         {
667                                 c = "^^";
668                                 if(substring(s, i+1, 1) == "^")
669                                         ++i;
670                         }
671
672                         if(c != " ")
673                         {
674                                 rgb = hsl_to_rgb('1 0 0' * (j * i + f) + '0 1 .5');
675                                 c = strcat(rgb_to_hexcolor(rgb), c);
676                         }
677                         s2 = strcat(s2, c);
678                 }
679
680                 localcmd(strcat(argv(1), " ", s2));
681
682                 return true;
683         }
684
685         return false;
686 }