+
+GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt")
+{
+ switch(request)
+ {
+ case CMD_REQUEST_COMMAND:
+ {
+ #ifndef MENUQC
+ float fh, alsoprint = false;
+ string filename = argv(1);
+
+ if(filename == "")
+ {
+ filename = "notifications_dump.cfg";
+ alsoprint = false;
+ }
+ else if(filename == "-")
+ {
+ filename = "notifications_dump.cfg";
+ alsoprint = true;
+ }
+ fh = fopen(filename, FILE_WRITE);
+
+ if(fh >= 0)
+ {
+ Dump_Notifications(fh, alsoprint);
+ LOG_INFOF("Dumping notifications... File located in ^2data/data/%s^7.\n", filename);
+ fclose(fh);
+ }
+ else
+ {
+ LOG_INFOF("^1Error: ^7Could not open file '%s'!\n", filename);
+ }
+ #else
+ LOG_INFO(_("Notification dump command only works with cl_cmd and sv_cmd.\n"));
+ #endif
+ return;
+ }
+
+ default:
+ case CMD_REQUEST_USAGE:
+ {
+ LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [filename]"));
+ LOG_INFO(" Where 'filename' is the file to write (default is notifications_dump.cfg),\n");
+ LOG_INFO(" if supplied with '-' output to console as well as default,\n");
+ LOG_INFO(" if left blank, it will only write to default.\n");
+ return;
+ }
+ }
+}
+