+ std::string::size_type x = newline.find(find);
+ while (x != std::string::npos)
+ {
+ newline.erase(x, find.length());
+ newline.insert(x, replace);
+ x = newline.find(find);
+ }
+ }
+
+ virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line)
+ {
+ userrec *u = NULL;
+
+ /* If theyre not registered yet, we dont want
+ * to know.
+ */
+ if (user->registered != REG_ALL)
+ return 0;
+
+ /* We dont have any commands looking like this, dont bother with the loop */
+ if (AliasMap.find(command) == AliasMap.end())
+ return 0;
+
+ irc::string c = command.c_str();
+ /* The parameters for the command in their original form, with the command stripped off */
+ std::string compare = original_line.substr(command.length());
+ while (*(compare.c_str()) == ' ')
+ compare.erase(compare.begin());
+
+ std::string safe(original_line);
+
+ /* Escape out any $ symbols in the user provided text */
+
+ SearchAndReplace(safe, "$", "\r");
+
+ for (unsigned int i = 0; i < Aliases.size(); i++)